Adding tables from spreadsheets

Home Forums WordprocessingML Adding tables from spreadsheets

This topic contains 4 replies, has 2 voices, and was last updated by  riaan_badenhorst@hotmail.com 8 years, 1 month ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #3323

    Hello

    I’ve been working for the last few months on creating documents using OpenXMLPowertools and having great results so far. Now I’ve come across a requirement to add tables from pre-existing spreadsheets. Basically I want to automate/standardise our proposal creation and there is always a section for the BOQ. Potentially I’d also want to automate the insertion of graphics files (solution diagrams).

    Any suggestions?

    #3329

    Eric White
    Keymaster

    Hi,

    I am currently working on (in the background) a conversion of SpreadsheetML to HTML/CSS. One idea here is that you can generate the HTML/CSS for a table or region in a spreadsheet, and then create a DOCX using the HtmlToWmlConverter module. You can then integrate this DOCX into other DOCX using DocumentBuilder.

    However, I am only half done with this module – I have coded the SmlDataRetriever, which retrieves the data along with relevant formatting information. One thing that this module does, which will be super important to you, is that it puts together the display value. In other words, it converts from the raw data in the XLSX to the value that you see when looking at the spreadsheet using Excel (the value you retrieve when getting the value using VBA).

    It is actually not a huge job remaining to create the HTML/CSS from the data that SmlDataRetriever returns, but I haven’t had the time.

    You very well may want to take the same approach – use SmlDataRetriver to get the data, and then generate HTML/CSS from that data, and then generate the DOCX markup using HtmlToWmlConverter. (If you want to contribute this code to Open-Xml-PowerTools, I would be happy!)

    But in any case, SmlDataRetriever is what you want to use.

    -Eric

    #3344

    Hi Eric,

    Thanks for the reply. I’ve just started to work with C# (or programming actually) so I’ll be honest and say, having looked at your XMLPowerTools, it’s still a bit “next level” for me. For the moment I’m happy to have taught myself enough C# to extract what I need from an SQL database with linq.

    Having said that, I learn fairly quickly (with some guidance) so maybe some day in the future I can contribute something useful.

    I’ll see if I can figure anything out!

    Have a nice day.

    #3346

    Eric White
    Keymaster

    Take a look at SmlDataRetriever – you don’t need to be able to code it, just use it. 🙂

    Its use is pretty easy. Look at the SmlDataRetriever01 example to see it in action.

    #3347

    Thanks Eric, I had not seen the latest updates. Download it and will give it a try.

    Thanks a lot!

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.