Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XLSX lib richtext #199

Open
staubli-74210 opened this issue Sep 2, 2020 · 0 comments
Open

XLSX lib richtext #199

staubli-74210 opened this issue Sep 2, 2020 · 0 comments

Comments

@staubli-74210
Copy link

I had a .xlsx file to read. The file contains Japanese cells. I was surprised to read more characters that what was displayed by Excel. I dived into library code and discovered that the extra characters are phonetic attributes of the cell. unfortunately, xlsx lib handles the cell content as a RichSring class, with 2 QStrings in fragmentTexts field, and concatenates the 2 strings in the value() return QString. This is not what is expected.
Furthermore, class Cell (http://qtxlsx.debao.me/cell.html) has a method to check if the cell is RichString but provides no method to get the values. I modified the class Cell as folows:

  • xlsxcell.h
    const RichString *richString() const;

  • xlsxcell.cpp
    const RichString *Cell::richString() const
    {
    Q_D(const Cell);
    if (isRichString())
    return &d->richString;
    return NULL;
    }

And could read the right cell content like this:

    Cell *cell= xlsx->cellAt(l,c);
    if (cell) {
        if (cell->isRichString()) {
            return cell->richString()->fragmentText(0);

...

What is your opinion ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant