Giter Site home page Giter Site logo

Comments (5)

Christoph-AK avatar Christoph-AK commented on June 11, 2024

I do it for every sheet directly before saving the file and it works fine.

Pass the amount of rows and columns you want to lock!

So in your case (1,2)

    sheet1.freeze_panes(1, 1);
    sheet2.freeze_panes(1, 1);
    sheet3.freeze_panes(1, 1);

    if excel.close().is_ok() {...}

from xlsxwriter-rs.

ryanmcgrath avatar ryanmcgrath commented on June 11, 2024

Hmmmm... well, I'm certainly open to being wrong. Suppose I'll tinker a bit more, there's probably something I've missed then. Thanks for the sanity check!

from xlsxwriter-rs.

Christoph-AK avatar Christoph-AK commented on June 11, 2024

If you post some code that refuses to work I might be able to help out more.

from xlsxwriter-rs.

jmcnamara avatar jmcnamara commented on June 11, 2024

It should work as expected. The only thing to look out for is to make sure that splitting cell is after the split, like in Excel.

I need to freeze the header (row 0) and the first two columns (columns 0 and 1).

In that case you would need to split at row = 1 and column = 2. This is still zero indexing but the split needs to be specified in the bottom right quadrant instead of the top left. Here is an example.

So Here is an example:

use xlsxwriter::Workbook;

fn main() -> Result<(), xlsxwriter::XlsxError> {
    let workbook = Workbook::new("freeze.xlsx");
    let mut worksheet = workbook.add_worksheet(None)?;

    for row in 0_u32..10_u32 {
        for col in 0_u16..8_u16 {
            worksheet.write_string(row, col, "Text", None)?;
        }
    }

    worksheet.freeze_panes(1, 2);

    workbook.close()
}

Output:

screenshot

I'd suggest closing this issue.

from xlsxwriter-rs.

ryanmcgrath avatar ryanmcgrath commented on June 11, 2024

Thanks!

from xlsxwriter-rs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.