LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I make my csv file created with LabVIEW look like as shown below? (See details and attached code)

Solved!
Go to solution

I would like to put borders as shown below. To be more specific, I would like to have borders. I want software to do the job of creating borders. The size of the borders does not matter to me. As long as I see borders that's all it matters.  I am using "write delimited spreadsheet.vi" to create a file (see attached code).

GRCK5000_0-1718630873999.png

 

I am pretty sure the report generation toolkit can get this done, but the only thing I don't like about the report generation toolkit is the create report VI

GRCK5000_1-1718631135193.png  always displays the file (csv) on the computer screen. I don't want the report to pop up. Alternatively, if the report generation toolkit can do the job without bringing the csv file on the computer, I will be fine. I just want the file to be saved on a specific folder on my computer. 

 

Code:

 

GRCK5000_2-1718631495092.png

Results that I don't want from the code above:

GRCK5000_3-1718631572614.png

 

 

0 Kudos
Message 1 of 5
(460 Views)

Hi GRCK,

 

CSV files are plain text files (with delimiters) and so they don't know anything about cell borders or cell colors!

 

When you need worksheet formatting (in Excel) then you need to save to a real Excel file format, like XLSX…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 5
(448 Views)

you will need to work with the Active X  functions to make Excel execute the formatting you want. 

If the format is fixed , you can then have a "template" on excell and just replace the data from the csv file and save it where you want it. 

Message 3 of 5
(417 Views)
Solution
Accepted by topic author GRCK5000

You can do what you need with the RGT.  There is a VI called Excel Set Color and Border where you can pick from several border lines.  It's in Excel Specific > Excel Format palette.

 

To keep Excel from opening, use a Window State of Minimized in Create Report, and at the end in Dispose Report set Wait until Printing Complete to False.

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019
Message 4 of 5
(395 Views)

There's a ten-year-old example I placed in the Forum that I think will answer most of your questions regarding the RGT ["Create Report" was called "New Report" back then -- it will still work, but you might as well fix it].  To prevent Excel itself from opening, look at the other inputs to Create Report.

 

Bob Schor

 

P.S. -- my program makes an Excel report, a .xlsx.  This has the ability to make borders, set Font properties, etc.  You can take the nicely-formatted Excel (.xlsx) file and ask Excel to save it as a .csv file (which Microsoft gives an Excel-like icon, making you think you have all of Excel's formatting properties, but as has been explained, a Comma-Separated-Variable (or .csv) file is an ordinary Text file with (typically) commas delimiting columns (although LabVIEW uses <Tab> by default), and New Lines delimiting rows.

Message 5 of 5
(388 Views)