LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Database Binary to .rtf in .net control box

Solved!
Go to solution

I have one vi where I save a .rtf file to a database like so:

 

Upload From ComputerUpload From Computer


Later, I get the file from the database and save it as an .rtf before I open it with another vi (*rtf viewer.vi*):

Download from DBDownload from DB

 

However, Although *rtf viewer.vi* will work with files that are not uploaded to the database, it cannot read these files. Opening a file in Notepad++ gets me the following:

 € Ā؀萀ĀĀ ᄠĀ  
 �{\rtf1\ansi\ansicpg1252\deff0\deflang1033\deflangfe1033{\fonttbl{\f0\fswiss\fprq2\fcharset0
 Calibri;}{\f1\froman\fprq2\fcharset2 Symbol;}}
 \viewkind4\uc1\pard\sa160\sl252\slmult1\b\f0\fs22 Known Issues:\par
 \pard\fi-360\li720\sa160\sl252\slmult1\b0\f1\'b7\tab\f0 VI Displays no
 error when "Print." is Selected with no printer attached\par
 \f1\'b7\tab\f0 Arduino driver does not currently initialize with
 startup\par \pard\sa160\sl252\slmult1\b Improvement Points:\par
 \pard\fi-360\li720\sa160\sl252\slmult1\b0\f1\'b7\tab\f0 Time numeric
 constants are listed in numeric format time format\par \f1\'b7\tab\f0
 Does not support test steps longer than 50 days\b\par
 \pard\sa160\sl252\slmult1 Change Log:\par
 \pard\fi-360\li720\sa160\sl252\slmult1\b0\f1\'b7\tab\f0 [Date] Fixed
 Issue with Results Display - JLS\par \f1\'b7\tab\f0 [Date] Added
 Arduino Control -JLS\par }

The file does save, however, it's not able to be read by my viewer vi.

What do I need to do to get my .rtf viewer to understand the file like it was able to before?

0 Kudos
Message 1 of 2
(2,765 Views)
Solution
Accepted by topic author ATE-EGNE

I more or less tried to replicate the issue by converting to Variant and saving the data directly to file and got something similar to what you're seeing.  The variant has a bunch of extra bytes, probably to describe data types and sizes.

writeRTF_bad.png

writeRTF_bad_results.png

 

If I convert the variant to string and then make sure I set the Prepend Array or string size? boolean to False, it saves the RTF file correctly:

writeRTFfile.png

writeRTF_results.png

 

 

0 Kudos
Message 2 of 2
(2,740 Views)