Recent

Author Topic: [SOLVED] Bugs. Apostrophe. Error working with sheet names in formula  (Read 1020 times)

veb86

  • Jr. Member
  • **
  • Posts: 62
In my calculator I use special names. which begin with <> characters. When writing a formula when the link goes to the name of a sheet with a special name, the name of the sheet is taken as an apostrophe.
When performing calculations, I change the name of the sheet, but do not remove the apostrophes. An error occurs in this formula when the library is running. The error occurs in places where there is a range, where just a cell reference is fine. For my part, I can solve the problem of apostrophes or most likely change the special character. But this will not solve the bug in the library.

Code: Pascal  [Select][+][-]
  1.     b.Options := [boReadFormulas];
  2.     b.ReadFromFile('d:\test1\5.xlsx', sfOOXML);
  3.     sh := b.GetFirstWorksheet;  
  4.     sh.WriteFormula(3,5,StringReplace(sh.ReadFormulaAsString(sh.GetCell(2,5)), '<BD>', 'BD', [rfReplaceAll, rfIgnoreCase]));
  5.     b.WriteToFile('d:\test1\555111111.xlsx', sfOOXML, true);    
  6.  

Сell(3,5) contains an error

The apostrophe works fine when there is a reference to one cell. Then I think it should work fine with the range
« Last Edit: July 18, 2024, 07:36:17 am by veb86 »

wp

  • Hero Member
  • *****
  • Posts: 12459
Re: Bugs. Apostrophe. Error working with sheet names in formula
« Reply #1 on: July 17, 2024, 05:58:38 pm »
Removed second quoting of worksheet names containing forbidden characters.

veb86

  • Jr. Member
  • **
  • Posts: 62
Re: Bugs. Apostrophe. Error working with sheet names in formula
« Reply #2 on: July 18, 2024, 07:34:25 am »
Everything works perfectly

 

TinyPortal © 2005-2018