Giter Club home page Giter Club logo

Comments (8)

meiMingle avatar meiMingle commented on September 6, 2024

Thanks for your feedback, I think I have fixed this issue, but the release date is not guaranteed

from fastexcel.

meiMingle avatar meiMingle commented on September 6, 2024

A temporary solution is to escape special characters beforehand.

...
worksheet.range(0, 0, row - 1, getDataRow1().size() - 1).createTable(escape(toArray(getHeadersCorrupt())))
                    .styleInfo().setStyleName("TableStyleMedium3");
...
...
    private String[] escape(String[] stringArray) {
        for (int i = 0; i < stringArray.length; i++) {
            stringArray[i] = XmlEscapeHelper.escape(stringArray[i]);
        }
        return stringArray;
    }
...

from fastexcel.

holleymcfly avatar holleymcfly commented on September 6, 2024

Hi Tom,

thanks for your investigation and reply.

Unfortunately, your suggested solution doesn't work. I had already tried to replace the ampersand with the escaped characters &. If I do this, the error message still comes up when the excel file is opened, and the header doesn't show the ampersand, but the escaped sequence.

Also, using your escape method (which seems to do the same for the ampersand), doesn't help. (I had to modify your solution slightly to "new XmlEscapeHelper().escape(.)", as the method is not static.

Best,
Holger

from fastexcel.

meiMingle avatar meiMingle commented on September 6, 2024

I'm not sure if you've applied the correct escapes because I can't see your code. In my test, the & is translated to &amp;,and stored in the table1.xml file. You can change the suffix of the generated xlsx file to zip, then unzip it and check the xl/tables/table1.xml file. Check the name property on table>tableColumns>tableColumn to see if the & is correctly escaped.

from fastexcel.

holleymcfly avatar holleymcfly commented on September 6, 2024

Yes, the & is translated to &amp; , and I can see it in the table1.xml file (I always investigate it with 7zip). But that doesn't make the error disappear.
Have you tried your solution with my sample project I created?

from fastexcel.

meiMingle avatar meiMingle commented on September 6, 2024

I just checked the code, and in the latest released version 0.18.0, the XmlEscapeHelper().escape(.) method is indeed not static. I have submitted the code to make changes to this a few months ago. This change is already in the latest code of the master branch, but when it will be released depends on the project owner.

from fastexcel.

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.