FPSpreadsheet 1.6: copy cell formatting lazarus / 49-FPSpreadsheet ---------------------------------------------------------------------- bonmario · 2015-08-28 09:55 Hi, i've made a new project that do this - read a ods file - write in a new ods file all row that contains a specific word I't works fine, but i'm unable to copy the cell formatting. Someone can explain me how do this? Thanks in advance, Mario ---------------------------------------------------------------------- bonmario · 2015-08-28 14:07 I have solved using this cose: Code: [Select]                  OutWorksheet.WriteCellFormat(CurCell, WrkCellPart^.CellFormat);                   OutWorksheet.WriteFont(CurCell, WrkCellPart^.Font.FontName, WrkCellPart^.Font.Size,                                          WrkCellPart^.Font.Style, WrkCellPart^.Font.Color); but i have a last problem: if a cell have more font or styles, this is non supported, FPSpreadsheet consider only one of them. Thanks, Mario ---------------------------------------------------------------------- wp · 2015-08-28 15:14 There are several overloads of  a "CopyFormat" method of the worksheet: Code: [Select]var   srccell, destcell: PCell; begin   srccell := OutWorksheet.WriteText(0, 0, 'This is a test');   OutWorksheet.WriteFont(srccell, 'Arial', 16, [fssBold], scRed);   destcell := OutWorksheet.WriteText(2, 2, 'copied format');   OutWorksheet.CopyFormat(srccell, destcell); As for your other question: fpspreadsheet does support several fonts within the same cell, but not in version 1.6. You'll have to go to the trunk version to get this feature. It is most easily applied if you disperse HTML code in the cell text and call the new text-writing method "WriteTextAsHTML". fpspreadsheet parses the cell text and creates the related "rich-text" parameters (see the examples in the "excel8write" demo): Code: [Select]  MyWorksheet.WriteTextAsHTML(2, 0, 'H2O');   MyWorksheet.WriteTextAsHTML(3, 0, 'red, yellow, green');   MyWorksheet.WriteTextAsHTML(4, 0, 'sin2 α + cos2 β = 1'); See http://wiki.lazarus.freepascal.org/FPSpreadsheet#Rich- text_formatting ---------------------------------------------------------------------- bonmario · 2015-08-28 16:50 OK thanks. Since I use it at work, I prefer to use stable releases, then wait for the release of version 1.8. Thanks again, Mario ---------------------------------------------------------------------- bonmario · 2015-08-31 07:57 Hi, i'm trying to made a test with SVN version, but i can't understand how read cell formatting. My problem is this: WriteText have a parameter "ARichTextParams", but ReadText havent'it. How can i read "ARichTextParams" from the cell? I've tried with this code, but don't work: Code: [Select]                  WrkCellPart:=MyWorksheet.GetCell(IdxRig, IdxCol);                   OutWorksheet.WriteText(RigaOut, IdxCol, MyWorksheet.ReadAsText(IdxRig, IdxCol), WrkCellPart^.RichTextParams); Thanks in advance, Mario ---------------------------------------------------------------------- wp · 2015-08-31 09:47 Quote from: bonmario on August 31, 2015, 09:57:52 amI've tried with this code, but don't work What is not working? Syntactically your code is correct. There is no reading method for the RichTextParams from the cell (just access them from the cell directly) because I thought nobody would need it. The reason is that the RichTextParams are specific to the text in the cell carrying them. A TRichTextParam is a record containing the font index to be used for the characters starting at the specified character index. Therefore it does not make sense to copy the RichTextParams to another cell having a different text. Except for "CopyCell" which duplicates a cell with all its contents and formatting to another place is working correctly, including RichTextParams because the text is the same in both cells. ---------------------------------------------------------------------- bonmario · 2015-08-31 10:08 The problem is with words with "StrikeThrough", how this: testword. When you wite the "