Giter Site home page Giter Site logo

Comments (5)

2ndDerivative avatar 2ndDerivative commented on June 10, 2024 1

That makes sense. So it would get plugged into the central system I suggested, that would be more idiomatic.

from rust_xlsxwriter.

jmcnamara avatar jmcnamara commented on June 10, 2024

Thanks for the detailed report.

As reported this isn't a bug since it isn't intended, in rust_xlsxwriter that the apostrophes are stripped in general. They are only removed when they are "notional", i.e., when they indicate the sheet name contains whitespace.

There probably does need to be centralised name checking, like you suggested in #45. I'll look into that.

I also need to check if there is a bug if an invalid worksheet name is passed as a chart range. I'll keep this open and look into that.

Thanks again.

from rust_xlsxwriter.

2ndDerivative avatar 2ndDerivative commented on June 10, 2024

According to the Microsoft spec it's not supposed to use apostrophes in general if I read this right
https://support.microsoft.com/en-us/office/rename-a-worksheet-3f1f7148-ee83-404d-8ef0-9ff99fbad1f9

from rust_xlsxwriter.

jmcnamara avatar jmcnamara commented on June 10, 2024

According to the Microsoft spec it's not supposed to use apostrophes in general if I read this right

Correct but rust_xlsxwriter doesn't sanitize the input (in this case). This would be considered a user input error and should raise a validation error.

However, I just checked and it doesn't:

use rust_xlsxwriter::{Chart, ChartType, Workbook, XlsxError};

fn main() -> Result<(), XlsxError> {
    let mut workbook = Workbook::new();
    let worksheet = workbook.add_worksheet();

    let data = [1, 2, 3, 2, 1];
    worksheet.write_column(0, 0, data)?;

    let mut chart = Chart::new(ChartType::Column);
    chart.add_series().set_values("'Sheet1!$A$1:$A$5");
    worksheet.insert_chart(0, 2, &chart)?;

    workbook.save("chart.xlsx")?;

    Ok(())
}
$ cargo run --example gh44    # No error.

So I'll look into that and fix it so that there is proper validation.

from rust_xlsxwriter.

jmcnamara avatar jmcnamara commented on June 10, 2024

Closing this and merging the issue with #45

from rust_xlsxwriter.

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.