Recent

Author Topic: Open xls and fill it  (Read 5099 times)

mirce.vladimirov

  • Sr. Member
  • ****
  • Posts: 268
Open xls and fill it
« on: August 27, 2013, 03:34:36 pm »
I'm using existing excel file (excel8) and filling it with freshly collected data from my aplication.
Code: [Select]
 
 EkselFile:=TsWorkbook.Create;
 EkselFile.ReadFromFile('my_excell_file.xls');
 MyWorksheet := EkselFajl.GetWorksheetByIndex(0);   // use the first worksheet

The existing file is using formulas to calculate procents and totals, it's formated, colored, bordered, bolded, underlined... so I'm using it and just put newly calculated data into it and then I save it:
Code: [Select]
   EkselFile.WriteToFile('the_new_file.xls', sfExcel8, true);
   ekselFile.Free; 

When I open the file i can see Data that i put on is correct while previous formating is lost, only the text of the headlines of columns and rows are kept but
- no more color,
- no bold fonts,
- fonts size set to default size,
- fonts all set to default font, and
- no more formula.

What am i missing ?

Mike.Cornflake

  • Hero Member
  • *****
  • Posts: 1269
Re: Open xls and fill it
« Reply #1 on: August 27, 2013, 04:26:44 pm »
http://wiki.freepascal.org/FPSpreadsheet#Support_by_file_format

Looks like only RPN formula's are supported in Excel 8 at the moment...

No idea about the formatting...

 
Lazarus Trunk/FPC latest fixes on Windows 11
  I'm getting old and stale.  Slowly getting used to git, I'll get there...

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Re: Open xls and fill it
« Reply #2 on: August 31, 2013, 05:36:46 pm »
Every feature needs to be supported in both the reader and the writer for this to work. And not all features are currently supported, so those that are unsupported get dropped.

 

TinyPortal © 2005-2018