Recent

Author Topic: [SOLVED] Latin OK Cyrilic wont work  (Read 6603 times)

mirce.vladimirov

  • Sr. Member
  • ****
  • Posts: 256
[SOLVED] Latin OK Cyrilic wont work
« on: May 14, 2012, 09:46:13 pm »
The first line is not even writen in the excel file, the second is fine :
Code: [Select]
  myworksheet.WriteUTF8Text(6, 3, 'Ова е текст на ќирилица');
  MyWorksheet.WriteUTF8Text(7, 3, 'ova e na latinica');

also tried the "utf8tocp1251()" trick, and it writes to the cell specified but it writes garbage characters, and I think that could be an unsupported font issue :
Code: [Select]
  myworksheet.WriteUTF8Text(6, 3, utf8tocp1251('Ова е текст на ќирилица'));
  MyWorksheet.WriteUTF8Text(7, 3, 'ova e na latinica');

Does anyone knows
why the first example wont even write ?
And how can I assign font to the text within a cell ?
« Last Edit: May 14, 2012, 10:04:51 pm by mirce.vladimirov »

mirce.vladimirov

  • Sr. Member
  • ****
  • Posts: 256
Re: [SOLVED] Latin OK Cyrilic wont work
« Reply #1 on: May 14, 2012, 10:07:42 pm »
I was testing with spreadsheet format 5 :
Code: [Select]
EkselFajl.WriteToFile(MyDir + 'my_xls_file.xls', sfExcel5, true);But it appeared that unicode is not supported with sfExcel5. So, I changed it to sfExcel8 and it works.

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Re: [SOLVED] Latin OK Cyrilic wont work
« Reply #2 on: May 15, 2012, 07:55:44 am »
why the first example wont even write ?

For sure it is written, but probably it contains only spaces or an invalid text.

Excel 2 to 5 has no Unicode support, so the UTF-8 text will be converted to the chosen encoding using the Encoding property.

Try doing this:

EkselFajl.Encoding := seCyrillic;
Before doing the WriteToFile

Read the comment in the declaration of the property TsWorkbook.Encoding

Quote
And how can I assign font to the text within a cell ?

To make a cell bold you can do this:

MyWorksheet.WriteUsedFormatting(7, 3, [uffBold]);

Bold, Text rotation, border and background color are supported, according to the following table: http://wiki.lazarus.freepascal.org/FPSpreadsheet#Progress_of_the_formatting_options

If you need more formatting options (italic or strikeout or something else) then you can open a bug report in our bug tracker and I will implement it when I have time.

 

TinyPortal © 2005-2018