LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Read chart axis titles from Excel chart programatically

Solved!
Go to solution

Does anyone know how to read the axis titles from existing excel charts, on excel sheets, using Labview?  I'm guessing that this is possible with Activex, but I can't work out how to do it.

 

The sheets I am working with come from elsewhere (and I would rather not require them to change their format if I can avoid it) and will have two charts (or more) on the sheet.  I would like to be able to get Labview to read the x and y graph axis titles on all charts on a given sheet.

 

I have attached a test sheet - note, this is just for testing and is not a copy of one of the real sheets, as these contain confidential information.

 

Thank you in advance,

 

David 

 

 

0 Kudos
Message 1 of 6
(2,522 Views)
Solution
Accepted by topic author dpak

It is not as straight forward as I had thought, but this seems to work.

ExcelAxisTitle.png

Message 2 of 6
(2,492 Views)

Thanks Ramon,

 

I have been diverted onto something else temporarily ( 😞 ) - So I will try this as soon as I get back to this task.  Thanks again for your help,

 

Kind regards,

 

David

0 Kudos
Message 3 of 6
(2,468 Views)

Hi Ramon,

 

Thanks for your solution.  It works!

 

I also found another way.  xlsx files are simply zip files.  Inside the zip files are a bunch of xml files spread through a small number of folders.  Inside the folder xl\charts, inside the zip file, there are xml files for every chart - CHART1.xml ... CHARTn.xml. The axis labels are stored in these xmls files under a specific tag: XPATH //chartSpace/chart/plotArea/valAx/title/tx/rich/p/r/t.

 

You do need to strip out the namespaces first.  See in the snippet.

Message 4 of 6
(2,448 Views)

Hi Dpak,

 

That seems much more straight forward. You should mark it as solution Smiley Tongue

0 Kudos
Message 5 of 6
(2,446 Views)

Hi Ramon,

 

Sorry for the delayed response - the university autumn term started and any development like this had to wait until the following summer!  Nothing gets done between October and June normally - except teaching related things.  And, by the summer, there were other fires ... you know how it is.

 

Your method using the nodes worked well enough for the project I as working on and I had that implemented quickly.

 

So, even though this is embarrassingly late - I wanted to respond and thank you again.

0 Kudos
Message 6 of 6
(1,758 Views)