Hello LabVIEW Friends,
Thought I would share an update to my Open Document Toolkit with you all,
One day I'll stick it on git, but git makes me sad...
I've been updating some old Laboratory Management code I wrote in LabVIEW 8.5 and one of the task was to print a report with tables in it. In the old code I used the report generation toolkit, but sadly NI have updated it so that it doesn't work now.... (nice)
I also want IT away from my system, so don't want Microsoft Office near my machines...
A perfect use case for my ODT toolkit
You can find more about this kit here -
81 - Open Document Text Document
181 - OpenDocument Format Session
The requirement was to be able to place a table of unknown dimensions onto a report, with the ability to adjust column widths and add column headers.
This whole toolkit is based on making a template with named book marks dictating where stuff goes. I use LibreOffice to create my templates.
As discussed in previous articles an open document file is just a zipped up folder (with 1 caveat!) with the contents as below.
We're interested in updating the styles.xml and content.xml files for tables. I can't be bothered to share the XML, have a look in the source-code if you are that interested.
I've created a new example called ODTableExample.vi
And here's the source..
With the new method for adding a table at the table at BM "TableBM".
One bit of code I like was that I needed to at style names, to ensure they were unique I would use a regex to find all the instances. I would then take the max value and add 1 to it. It works rather well.
For those unfamiliar with regular expressions (regex), they are a nifty and efficient way to find things in text. In this case I was looking for sentences that included {<style:style style:name="P} and up to 6 digits after that but before {" style:family="paragraph"}, which is the regular expression "\d{1,6}". I tested it with https://regex101.com/
All written in LabVIEW 2018.
Hope everyone is well
Lots of Love
Steve
Opportunity to learn from experienced developers / entrepeneurs (Fab,Joerg and Brian amongst them):
DSH Pragmatic Software Development Workshop
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.