How to bold some characters of a cell?
lazarus / 49-FPSpreadsheet
----------------------------------------------------------------------
Jvan · 2021-04-13 20:06
I wanna bolt from character 0 to 5, for instance. How to do it?
----------------------------------------------------------------------
wp · 2021-04-13 22:36
You can add an optional array of "rich-text parameters" to the
WriteText command; each element of this array contains the character
index at which the font specified by its font index will be applied
until revoked by another rich-text element.
It is easier, however, when you write html codes to the cell:
Code: Pascal [Select][+][-]window.onload = function(){var x1 =
document.getElementById("main_content_section"); if (x1) { var x =
document.getElementsByClassName("geshi");for (var i = 0; i program
Project1; uses fpspreadsheet, fpstypes, fpsopendocument;var wb:
TsWorkbook; sh: TsWorksheet;begin wb := TsWorkbook.Create; try
sh := wb.AddWorksheet('Page 1'); sh.WriteTextAsHTML(0, 0,
'123456789'); sh.WriteTextAsHTML(1, 0, 'This is
bold.'); sh.WriteTextAsHTML(2, 0, '10 cm3');
sh.WriteTextAsHTML(3, 0, 'red green blue');
sh.WriteTextAsHTML(4, 0, 'This is important');
sh.WriteTextAsHTML(5, 0, 'This is wrong');
wb.WriteToFile('test.ods', true); finally wb.Free; end;end.
See also: https://wiki.lazarus.freepascal.org/FPSpreadsheet#Rich-
text_formatting
----------------------------------------------------------------------
Jvan · 2021-04-14 01:12
Thanks, it works.