Code Monkey home page Code Monkey logo

Comments (5)

jmcnamara avatar jmcnamara commented on July 17, 2024

The "Content is Unreadable. Open and Repair" error is Excel's standard warning for any validation error in the XML used for the components of the XLSX file. It doesn't really help to identify the problem.

You will need to submit a small working example that demonstrates the issue. See the Bug Reporting Guidelines.

Note, libxlsxwriter does work with UTF-8. There is an example in the docs/repo and there are several test cases that test it.

John

from libxlsxwriter.

sw1020 avatar sw1020 commented on July 17, 2024

sorry
the utf-8 string example (in hex): e5 9b be 14 e5 9b be
if i replace 0x14 to 0x20 ,it will work fine

from libxlsxwriter.

jmcnamara avatar jmcnamara commented on July 17, 2024

The non-unicode character 0x14 is a control character. These aren't currently supported in libxlsxwriter.

I'll fix that in a later version but for now make sure that your strings don't contain control characters.

from libxlsxwriter.

jmcnamara avatar jmcnamara commented on July 17, 2024

Here is an example program that demonstrates the issue:

#include "xlsxwriter.h"

int main() {

    lxw_workbook  *workbook  = new_workbook("gh42_1.xlsx");
    lxw_worksheet *worksheet = workbook_add_worksheet(workbook, NULL);

    char string[] = {0xe5, 0x9b, 0xbe, 0x14, 0xe5, 0x9b, 0xbe, 0x00};

    worksheet_write_string(worksheet, 0, 0, string, NULL);

    workbook_close(workbook);

    return 0;
}

And here is a working example with the control character replaced with a space:

#include "xlsxwriter.h"

int main() {

    lxw_workbook  *workbook  = new_workbook("gh42_2.xlsx");
    lxw_worksheet *worksheet = workbook_add_worksheet(workbook, NULL);

    char string[] = {0xe5, 0x9b, 0xbe, 0x20, 0xe5, 0x9b, 0xbe, 0x00};

    worksheet_write_string(worksheet, 0, 0, string, NULL);

    workbook_close(workbook);

    return 0;
}

from libxlsxwriter.

jmcnamara avatar jmcnamara commented on July 17, 2024

Fixed in version 0.2.7 and the master HEAD on Github.

Thanks.

from libxlsxwriter.

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.