Home > Software engineering >  VC6.0 generated EXCEL cell to text format, how to numerical format
VC6.0 generated EXCEL cell to text format, how to numerical format

Time:09-16

Everybody is good! Recently with VC6.0 to download data from flash into Excel, Excel in cell Numbers are generated to text format (the front with a comma), how to generate numerical format? The code is as follows:
Void CEvent_dlg: : OnTimer (UINT nIDEvent)
{
//TODO: Add your message handler code here and/or call the default
Int temp_state temp_download;
Unsigned int n;
Cstrings strtemp_eventnum;

The switch (nIDEvent)
{
Case 1:
/* event log download making excel spreadsheet */
If (Event_Num & gt; 0)
{
Temp_download=(int) ((float) Event_DCunter/(float) Event_Num * 100);
M_Progress. SetPos (temp_download);
If (Event_DFinishFlag==1)//the event log after handling the mark of a
{
Temp_download=100;
M_Progress. SetPos (temp_download);
Event_DFinishFlag=0;
KillTimer (1);
//to build EXCEL spreadsheets
CSpreadSheet SS (sExcelFile, "EventDataSheet");
CStringArray sampleArray testRow;
SS. BeginTransaction ();

//add title
SampleArray. RemoveAll ();
SampleArray. Add (" record time ");
SampleArray. Add (" state of the FPGA ");
SampleArray. Add (" digital input ");

SS. AddHeaders (sampleArray);

Temp_series_num=(unsigned int) (Event_DCunter/150);
//add data
For (unsigned int I=0; I{

//add article fault interval identifiers
Strtemp_eventnum. The Format (" % d ", (I));
Event_SeriesNum [I]="the event log series number (EventFault_series_num)=" + strtemp_eventnum;
SampleArray. RemoveAll ();
SampleArray. Add (Event_SeriesNum [I]);
SS. AddRow (sampleArray);
For (unsigned int j=0; j<150; J++)//add data
{

N=I * 150 + j;
SampleArray. RemoveAll ();
SampleArray. Add (Timer_event [n]);
SampleArray. Add (SysStatus_event [n]);
SampleArray. Add (LOCALDIN_event [n]);
SS. AddRow (sampleArray);
}
}

SS.Com MIT ();
Event_DCunter=0;
}
} break;
Default: break;
}
UpdateData(false);
CDialog: : OnTimer (nIDEvent);
}

The above variables definition: CStringArray sampleArray testRow;
Cstrings Timer_event [4096].
SysStatus_event [4096].
LOCALDIN_event [4096].
Bother everybody to help have a look at how to modify to make the output cell for numerical format, be obliged!

CodePudding user response:

Excel in cell Numbers are generated to text format (the front with a comma), how to generate numerical format?

The value in Excel format can't take my comma

CodePudding user response:

Set up the corresponding columns NumberFormat attribute

CodePudding user response:

Thank you for your answer! How to set up the corresponding columns NumberFormat attribute? Trouble you on the basis of the above, for example, thank you thank you very much!

CodePudding user response:

Use VBA is Worksheets (" Sheet1 "). The Columns (1). The NumberFormat="@"
  • Related