07-19-2017 01:00 PM
I'm trying to write hex strings to an excel file using Excel Report, but I came across cases where the string happens to be in scientific notation ("3E04"). The excel file interprets "3E04" as 30000. I'm using SetCellValue to write to the file and I've specified that the type is a string. I understand that from Excel it is possible to format cells to be straight text, but how can I do that from CVI, such that it is interpreted as text and not numeric?
This is my code:
ExcelRpt_SetCellValue(OutputWorksheet, "A1", ExRConst_dataString, "3E04");
I'm using LabWindows CVI 2013 and MS Excel 2007
Solved! Go to Solution.
07-19-2017 04:22 PM
Can you try prefixing the hex string with a ' character. So 3E04 will look like '3E04. That works when I want to type a hyphen (-) in a cell to show it is empty and Excel tries to use it as a minus sign and start doing math. In that case Excel does not change mode, and prints only the - not the '
Hope this helps
07-19-2017 04:26 PM
When I cannot change cell type from CVI, I create a template file formatted according to my application and clone that file first and then fill it with values.
That might not work for your application if data sizes vary from run to run. But otherwise it may solve your problem.
Or you can use Excel library, not ExcelRpt, which is a bit more difficult to use.
07-20-2017 06:55 AM
Thank you so much, ebalci! It worked perfectly!