Wrong font size and row heights in ODS file [SOLVED] lazarus / 49-FPSpreadsheet ---------------------------------------------------------------------- totya · 2016-11-05 14:48 Hi! See attached file (converted from excel file). Font size often wrong, and cell heights are wrong too from line 31. File converted and saved with Libre Office 5.2.2.2 I tested it with latest svn Spready. Thanks! ---------------------------------------------------------------------- wp · 2016-11-05 15:34 Please post the original Excel file as well. Rich-text is quite complicated, Excel refuses to load the file, and in Calc I don't see the sub/superscripts that I see in Spready. Let me first check whether Spready displays the original file correctly. ---------------------------------------------------------------------- Thaddy · 2016-11-05 15:46 Check if the fontsize is in pixels or points (needs to be negative or positive integer value). If changing sign on the fontsize helps, then that was programmer error. But in that case: even I   forget about that from time to time ---------------------------------------------------------------------- totya · 2016-11-05 15:49 Quote from: wp on November 05, 2016, 04:34:38 pmPlease post the original Excel file as well. Hi! Certainly! Original excel file seems to me correct in my app, but in spready I see a problem, for example the 1-30 line wordwrap are missing, so the text in these cells are truncated. ---------------------------------------------------------------------- Thaddy · 2016-11-05 15:51 Our posts crossed. See my pointer... ---------------------------------------------------------------------- wp · 2016-11-05 16:27 Did you write the xls file with fpspreadsheet? If yes: was the spreadsheet in a grid before writing? If not then fpspreadsheet does not know about rowheights and just writes the default row height. When Spready opens the file later it just sees rows with default row heights, i.e. the word wraps seem to be gone. But they are not. Go to "Row" / "Auto row heights", and Spready will iterate through all rows and recalculate row heights - and the word wraps will be back. They can be at different positions because I don't know how Excel exactly calculates row height from font size (there are a few font-size- dependent pixels for margins etc). I do not want to activate auto rowheight calculation in Spready automatically because this process is rather slow. But using the new menu command "Auto row heights" you have the option to do this manually. The other problem is why Spready so wildly misinterprets the text positions and adds superscripts which are not there in the first place. During the conversion, Calc had added this attribute to the text styles: style:text-position="0% 100%" - the first number means the vertical text offset. This attribute is known by the ods reader, but it expects the keywords "super" or "sub" here instead. So - I thinks this can be fixed. ---------------------------------------------------------------------- wp · 2016-11-05 16:50 Quote from: wp on November 05, 2016, 05:27:34 pmThe other problem is why Spready so wildly misinterprets the text positions and adds superscripts which are not there in the first place. Try the new revision. ---------------------------------------------------------------------- totya · 2016-11-05 19:05 Hi! Quote from: wp on November 05, 2016, 05:27:34 pmDid you write the xls file with fpspreadsheet? No. Quote from: wp on November 05, 2016, 05:27:34 pmI do not want to activate auto rowheight calculation in Spready automatically because this process is rather slow. But using the new menu command "Auto row heights" you have the option to do this manually. Yes, I see. Quote from: wp on November 05, 2016, 05:27:34 pmThe other problem is why Spready so wildly misinterprets the text positions and adds superscripts which are not there in the first place. With latest svn, ods file opened exactly, wordwrap is okay in line 1-30, the xls file need autorowheight of this. So now the ods file works better than xls (without autorowheight). Thanks for your excellent job! ps.: I found small eror in ods: 1-30 line first word "test" y positions are wrong, these start in higher positions, than normal. See attached picture. ---------------------------------------------------------------------- wp · 2016-11-05 22:16 Quote from: totya on November 05, 2016, 08:05:41 pmQuote from: wp on November 05, 2016, 05:27:34 pmDid you write the xls file with fpspreadsheet? No.Sorry to be insistent: With which program did you write the xls file? If you used Excel then I wonder why it does not write the row heights which it did in all my tests. Quote from: totya on November 05, 2016, 08:05:41 pmSo now the ods file works better than xls (without autorowheight).My interpretation is that ods did write the row heights when you converted the xls to ods. Quote from: totya on November 05, 2016, 08:05:41 pmI found small eror in ods: 1-30 line first word "test" y positions are wrong, these start in higher positions, than normal. Regarding the shifted y positions, there seems to be the problem that the first "Test" is painted with a different font. This is probably the main bug because if there are different fonts within a row, or even within a cell, the vertical text placement is not good because the exact font metrics of the text baseline is not considered at the moment. There are also errors in the html edit lines created from the rich- text parameters of the cell. A lot to do... ---------------------------------------------------------------------- totya · 2016-11-05 22:39 Hi! Thanks for the answer! To tell the truth, the exact ods file handle isn't important for me at the moment. But you have many job in this great component, I thought you want to know, if any bugs present. QuoteWith which program did you write the xls file? IIRC I created this sample with Excel 2003 or 2007 (hungarian version) all with latest SP. If I have time, I will play with it, and I see row heights are correct or not, and I will upload sample. But I have very big problems at home... ---------------------------------------------------------------------- wp · 2016-11-05 23:03 Quote from: totya on November 05, 2016, 11:39:27 pmIf I have time, I will play with it, and I see row heights are correct or not, and I will upload sample. But I have very big problems at home... No no - that's ok. I have all that I need. ---------------------------------------------------------------------- wp · 2016-11-06 08:39 Reading of xls row heights fixed now. ---------------------------------------------------------------------- totya · 2016-11-06 09:47 Quote from: wp on November 06, 2016, 09:39:42 amReading of xls row heights fixed now. Hi! Thanks for your job, I see the results in spready. Small error, the first line in cells are empty (first-spready, second- excel): ---------------------------------------------------------------------- wp · 2016-11-06 10:50 This brings us back to the point where I cannot continue because I don't know how Excel calculates the cell size. Therefore, my calculations result in a three-line cell while Excel wants four lines. You see the issue? Excel writes the height of four lines to the file, Spready uses this value for displaying its three-line cell. Again, an automatic row height calculation would help but I don't want to do this because it is slow. Use "Row" / "Auto row heights" to fix it. ---------------------------------------------------------------------- totya · 2016-11-06 10:53 Okay, thanks for the answer! I always use auto row heights in my app, I only showed this problem.