0

I filled an Excel table via QXlsx (available on GitHub) with numbers that should in any case be treated as strings. In Excel the affected cells show a green triangle which says that the content is actually a number.

Excel Screenshot

In Excel I found an option which suppresses the warnings. But I am searching for a solution within QXlsx. Thanks for your support.

shrivallabha.redij
  • 5,832
  • 1
  • 12
  • 27
MegaPit
  • 1
  • 1
  • Seems better asked on that project's own repository/issue tracker. – underscore_d May 27 '20 at 10:38
  • How do you write your numbers into the Excel document? – vahancho May 27 '20 at 10:47
  • In QXlsx there is the method: bool write(int row, int col, const QVariant &value, const Format &format=Format()); – MegaPit May 27 '20 at 10:56
  • @MegaPit, I see, but how do you use that function in your code? – vahancho May 27 '20 at 11:03
  • There is nothing special to say. I have two methods AddColumn and AddValue which create one after another the table. – MegaPit May 27 '20 at 11:43
  • Try converting `value` to an alphanumeric variable. – Luuk May 27 '20 at 11:51
  • That is a **feature** of Excel. Unless `Qxlsx` has a method for suppressing that warning in the Excel application, I don't think you'll be able to. – Ron Rosenfeld May 27 '20 at 12:21
  • Seems you already asked with the maintainer:(https://github.com/QtExcel/QXlsx/issues/87), but it also seems he is busy, there are a lot of items having status 'help wanted' – Luuk May 27 '20 at 13:59
  • 1
    @MegaPit: Here's the relevant documentation: https://support.office.com/en-us/article/fix-text-formatted-numbers-by-applying-a-number-format-6599c03a-954d-4d83-b78a-23af2c8845d0. You can turn it off: File > Options > Formulas > Error checking rules > Unheck "Numbers formatted as text or preceded by an apostrophe" > OK. – Azeem May 28 '20 at 09:52
  • @Azeem: Thanks for your help! But I try to solve the problem programmaticaly with QXlsx which is an Excel library for Qt/C++ – MegaPit May 28 '20 at 12:15
  • @MegaPit: Sure, no problem! I've looked at it. Reproduced your scenario with a sample program and then figured out that the library has nothing to do with it. It just reads/writes/manipulates in that specific format. It doesn't control MS Excel. MS Excel generates those warnings and you can either turn those off or just let them be. – Azeem May 28 '20 at 12:22
  • This is how to ignore the error using VBA: https://stackoverflow.com/questions/18317555/ignore-number-stored-as-text-error-in-excel-programmatically-using-vba – Luuk May 28 '20 at 16:23

0 Answers0