Writing comments to xlsx files produces unreadable files lazarus / 49-FPSpreadsheet ---------------------------------------------------------------------- wp · 2015-02-06 22:09 Currently, I am implementing cell comments for fpspreadsheet. At the moment, however, I am fighting with writing xlsx files containing comments. The attached file "test-comments-fps.xlsx" was written by fpspreadsheet, it contains only a single cell (A1) to which a comment is attached. The comment really is contained in the file since it can be seen by OpenOffice and  the fpspreadsheet demos. But Excel refuses and rejects the "drawing form". The other file, "test-comments- Excel2007.xlsx", has roughly the same content, but was written by Excel2007 directly. Of course, it opens fine in Excel. I checked it again and again, but I can't see the difference (in fact there are some intentional differences but I checked that they do not have an effect on readability). Here's what I found out about comments in xlsx files after renaming their extension to zip and looking at the unzipped xml files: For every worksheet, there is a file sheetX.xlm (X=1,2,...) in folder xl/worksheets.Unlike with OpenDocument, the cell nodes do not contain the comment information directly, but Microsoft collects comment texts and formatting in files commentY.xml (Y=1,2,...) in folder xl and drawing information (shape, color, shadow, ...) in files vmlDrawingY.vml(Y=1,2,...) in folder xl/drawings. The worksheetX file contains only a new node - there are so many rId1 in the xlsx file, it is not clear what it means.Every worksheet needs a rels file in folder xl/worksheets/_rels, named exactly like the sheetX.xml file, but with the additional extension .rels. It lists the paths to the comments.xml and vmlDrawing.vml files which belong to this particular worksheet. The paths are relative to the sheetsX.xml file.The comments.xml file contains a reference to the cell to which the comment belongs ("comment ref")The vmlDrawing.vml file repeats this information in the nodes and has to match the . No idea about the logics behind and - Exels seems to take the sheet index X into account, but I could change these values arbitrarily. Anyway, this is not relevant to the uploaded sample which contains only one sheet.I know there are great Sherlock Holmes guys out there who certainly can help me with my blindness. (If the sources were needed - they are uploaded to fpspreadsheet trunk). ---------------------------------------------------------------------- wp · 2015-02-07 22:07 Found it - incorrect MIME string for the vmlDrawing. (Now only BIFF8 is left - this will be tough...)