QXlsx icon indicating copy to clipboard operation
QXlsx copied to clipboard

Cell formula from row/col

Open skypjack opened this issue 5 years ago • 11 comments

Imagine I want to define a formula like =SUM(A1, A100). However, I don't know the letter of my column nor the row I'm working on. This is because I'm dynamically filling a document from a flow of data from a db. All I have is a bunch of numeric row/col. Is there any way to create a formula from them? Otherwise, if I used cellAt to get the Cell * at a given position, is there any way to get from that its string representation (like A5)?

Thank you.

skypjack avatar Feb 18 '20 15:02 skypjack

I'll register this issue as invalid. Thanks for reporting.

j2doll avatar Feb 19 '20 12:02 j2doll

I'll register this issue as invalid.

Why as invalid? I mean, if there is a way to do that, then I'd be glad to know it. Otherwise it could be an useful add-on, couldn't it? In both cases, an answer would be useful for future users. :wink:

skypjack avatar Feb 19 '20 13:02 skypjack

The function you mentioned is a function that must be supported by the ECMA-376 standard. But QXlsx does not support. 😞

And it's not easy to develop this function with my personal work now... As you know, South Korea is distracted by the corona virus, and my life is hampered...

j2doll avatar Feb 20 '20 14:02 j2doll

I see. So, is the project no longer maintained or is there the possibility to see it evolve in future? It's pretty interesting and full of functionalities, it would be great if it won't get abandoned.

skypjack avatar Feb 20 '20 20:02 skypjack

The formula is the most used function in Excel, so it is necessary. I will register as an enhancement for the future.

And I wish the damn corona virus to go away quickly.

j2doll avatar Feb 24 '20 13:02 j2doll

I also created an Excel template to work with, but using QXlsx to process the document would cause all the formulas in the template to be cleared to "#DIV/0!" such characters. Can I save Excel without changing the original formula?

Shine6Z avatar Jul 06 '20 09:07 Shine6Z

Dear @Shine6Z Not now. I hope it will go well someday. 😢

j2doll avatar Jul 06 '20 10:07 j2doll

Dear @Shine6Z Not now. I hope it will go well someday. 😢

Now I use another table to apply the scheme to solve the problem. The required data of the formula table is obtained from another non-formula table, and the data format and formula of the source table are not changed, so that my formula requirements can be realized. I do not know whether the NPOI project is helpful to this project.

Shine6Z avatar Jul 07 '20 01:07 Shine6Z

When I summarize the issues in the meantime, it seems that there are many problems in the following fields.

  • formulas
  • charts
  • comments
  • large amounts of data
  • only part of the ECMA standard is applied.

I am waiting for those who can help with these issues. Of course, I'm also working on it, but my personal commercial project is immersed in mud, making it difficult to solve in a short time.

My English is not good. If the sentence is strange, ask again please.

j2doll avatar Jul 08 '20 11:07 j2doll

When I summarize the issues in the meantime, it seems that there are many problems in the following fields.

  • formulas
  • charts
  • comments
  • large amounts of data
  • only part of the ECMA standard is applied.

I am waiting for those who can help with these issues. Of course, I'm also working on it, but my personal commercial project is immersed in mud, making it difficult to solve in a short time.

My English is not good. If the sentence is strange, ask again please.

Thank you for your reply. I think I can use data table and formula call table to achieve data calculation at present. I will still follow up and look for solutions for this problem in the future, because this thing is often used.

Shine6Z avatar Jul 09 '20 08:07 Shine6Z

As workaoround use code like this:

`auto bruttoCell = QXlsx::CellReference(row, col);

const auto &formcCosts = QString("=%1/2 ").arg(bruttoCell.toString());

c++;

doc.write(row, col, formcCosts);`

cezaryece avatar Jan 18 '23 13:01 cezaryece