Menu

Formatting lost when opening the output xlsx file with Office 2016 (but not with Libre Office)

2019-07-05
2019-07-29
  • Javier Bazan

    Javier Bazan - 2019-07-05

    As always Larry, thank you for taking the time of building and maintaining this great tool!

    Was creating some new reports and for the first time tested the results in Office 2016 (I've been always using Libre Office) and realized that with Microsoft's product the format is lost after the csv content is dumped into the xlsx template.

    Libre Office: everything is fine, the final xlsx file has the header, font, size, centered, etc (so it preserves the entire formatting that I defined on my xlsx template). But if I open the same final xlsx file with Office 2016 the formatting is lost (except the header), so formatting is reset to default; calibri font, font size 11 and aligned to the left from row 2 till the end of the file.

    Command being used:

    csv2odf -v -t 3 -c ";" "$XLSX_TAB_3" "$XLSX_TEMPLATE" "$XLSX_FINAL"

    Is this something you can take a look when you have time?
    Thank you,

     
  • Larry Jordan

    Larry Jordan - 2019-07-05

    I will look into it. Office is more particular about having everything coded perfectly, whereas LibreOffice will allow some variances.

    Thanks.
    Larry

     
  • Larry Jordan

    Larry Jordan - 2019-07-06

    Javier,

    I recieved your template.

    The only problem I see is that you need some sample data on the second row. I know it is not obvious why it is necessary, but the way the spreadsheets work is if a cell is empty it is compressed down in a way that csv2odf has nothing to grab on to. So what you need is some dummy data, it can be simple like a zero where a number goes, or the letter A where some text will go. That will create an "instance" of the cell with formatting applied. Csv2odf will take that and replace it with the data from the csv file and replicate the formatting on every row.

    Try that and see if it resolves the formatting issue.

    Thank you!
    Larry

     
  • Javier Bazan

    Javier Bazan - 2019-07-10

    Thank you Larry! Finishing some work now and I will test this either today or tomorrow. Will get back to you with the results.

    Best regards,

     
  • Javier Bazan

    Javier Bazan - 2019-07-29

    Hi Larry!

    I apologize for the delay in getting back to you, work has been keeping me very busy.

    Just wanted to let you know that your workaround works perfectly! After adding "null" on row #2 the formatting is kept. I can successfully see my template in both Libre Office and Microsoft Office.

    Thanks a lot!! (owe u beer!)
    Cheers

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.