LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

ni report generation problem

Hi,

 

When I use Ni report generation in CVI to print my test data, I found it's hard to make the column  in a line.

 

I generate PDF format file to display the print result, see attachment.

 

the following is my source code:

/////////*******************

 char msg[255]; 

#define SPACING "       "   // 7 space, add by andy 

 

 sprintf( titleFine, #%-10sSignal%-sAlarm Type%-10sLength%-10sRotation%-10sArea(%s^2)%-10sAmp-10%sDepth,

            SPACING, SPACING, SPACING, SPACING    SPACING, SPACING, "mm", SPACING, SPACING ); 

       for (i=0; i<count; i++) 

{

 sprintf(msg, "%02d%s%9s%s%6s%15s%-6.1f/%-6.1f%s%-6.1f/%-9.1f%-15s%-6.0f%10s%-6.1f%10s%-6.2f",
                             i+1, SPACING, rollHeader.Out_SignalName[j],SPACING,
           inspectMode==BLOBPART_BRUISE ? MAIN_get_message(MSG_CSCAN_FLAW_LOWER) : MAIN_get_message(MSG_CSCAN_FLAW_UPPER),
        SPACING, (float)x1, (float)x2,SPACING,(float)y1, (float)y2, SPACING, area, SPACING, amp, SPACING,m_depth );  

 

 NIReport_AppendLine (reportHandle, msg);  

 

////*******************

 

 

*****************************************************************
Work hard and enjoy life.
Love CVI and Labview!
Certified Labview Developer
0 Kudos
Message 1 of 5
(3,701 Views)

Try to use "/t" (not "SPACE" ), that is :

 

sprintf(msg, "%02d%c%9s%t%6s%15s%-6.1f/%-6.1f%s%-6.1f/%-9.1f%-15s%-6.0f%10s%-6.1f%10s%-6.2f",
                             i+1, '/t', rollHeader.Out_SignalName[j],'/t', 
          ...      ...

 

 

NI Applications Engineer

0 Kudos
Message 2 of 5
(3,675 Views)

Thank you!! I try to use "\t", but it doesn't work:Smiley SadSmiley Mad

 

 sprintf(msg, "%02d%c%9s%c%6s%c%-6.1f/%-6.1f%c%-6.1f/%-9.1f%c%-6.0f%c%-6.1f%c%-6.2f", i+1, '/t', rollHeader.Out_SignalName[j],'/t', spectMode==BLOBPART_BRUISE ? MAIN_get_message(MSG_CSCAN_FLAW_LOWER) : MAIN_get_message(MSG_CSCAN_FLAW_UPPER), '/t', (float)x1, (float)x2,'/t',(float)y1, (float)y2, '/t', area, '/t', amp, '/t',m_depth );

 

The result refer to Testresult1.jpg

 

I also try to use as this, but it doesn't work:

 

sprintf(msg, "%2d\t%s\t%6s\t%6.1f/%6.1f\t%6.1f/%6.1f\t%6.0f\t%6.1f", i+1, rollHeader.Out_SignalName[j], inspectMode==BLOBPART_BRUISE ? MAIN_get_message(MSG_CSCAN_FLAW_LOWER) : MAIN_get_message(MSG_CSCAN_FLAW_UPPER), (float)x1, (float)x2,(float)y1, (float)y2, area, amp );

 

The result refer to Testresult2.jpg

 

 Pls help me, thank many!

帖子被侠客在 12-09-2008 12:28 AM
时编辑过了
*****************************************************************
Work hard and enjoy life.
Love CVI and Labview!
Certified Labview Developer
Download All
Message 3 of 5
(3,669 Views)

I see your results, why not add in a table, you can use the cell to achieve the alignment with the table operation functions:

Start TableNIReport_TableStart
End TableNIReport_TableEnd
Append RowNIReport_TableAppendRow
Next CellNIReport_TableNextCell
Set Table Column WidthNIReport_TableSetColWidth
Get Table Column WidthNIReport_TableGetColWidth
Set Table AttributeNIReport_SetTableAttribute
Get Table AttributeNIReport_GetTableAttribute

 

NI Applications Engineer

 

帖子被Topkins在 12-09-2008 03:28 AM
时编辑过了
0 Kudos
Message 4 of 5
(3,657 Views)

Thank you very much.. I really appreciate your help!!

*****************************************************************
Work hard and enjoy life.
Love CVI and Labview!
Certified Labview Developer
0 Kudos
Message 5 of 5
(3,641 Views)