12-07-2008 09:31 PM
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);
}
////*******************
12-08-2008 07:52 PM
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
12-09-2008 12:26 AM - edited 12-09-2008 12:28 AM
Thank you!! I try to use "\t", but it doesn't work:![]()
![]()
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 03:27 AM - edited 12-09-2008 03:28 AM
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 Table | NIReport_TableStart |
| End Table | NIReport_TableEnd |
| Append Row | NIReport_TableAppendRow |
| Next Cell | NIReport_TableNextCell |
| Set Table Column Width | NIReport_TableSetColWidth |
| Get Table Column Width | NIReport_TableGetColWidth |
| Set Table Attribute | NIReport_SetTableAttribute |
| Get Table Attribute | NIReport_GetTableAttribute |
NI Applications Engineer
12-09-2008 07:26 AM
Thank you very much.. I really appreciate your help!!