extern "C" int PASCAL EXPORT SaveExcelFile(MzFileStruct MzF)
{
long nIndex,nTemp2;
CString sSql,sBak,sFileTxt;
CDatabase database;
char sDriver[40];
HCURSOR hOldCursor;
int nNumberOfX,nNumberOfY,nNumberOfZ,nStepX,nStepY,nStepZ,nStartX,nStartY,nStartZ,nTemp4;
double fTemp1=0.001;
nNumberOfX=MzF.nNumberOfX;
nNumberOfY=MzF.nNumberOfY;
nNumberOfZ=MzF.nNumberOfZ;
nStepX=MzF.nStepX;
nStepY=MzF.nStepY;
nStepZ=MzF.nStepZ;
nStartX=MzF.nStartX;
nStartY=MzF.nStartY;
nStartZ=MzF.nStartZ;
for(int i=0;i<MzF.nGain;i++)
fTemp1/=10.0;
if(GetExcelDriver(sDriver))
{
MessageBox(NULL,"请安装ODBC数据库驱动.","",MB_OK);
return 1;
}
if(MzF.nTableIndex==0)
{
CFileDialog cSaveAs(FALSE,"xls",NULL,OFN_OVERWRITEPROMPT,"EXCEL文件(*.xls)|*.xls|");
if(cSaveAs.DoModal()!=IDOK)
return 1;
sFile=cSaveAs.GetPathName();
DeleteFile(sFile);
}
hOldCursor=GetCursor();
SetCursor(LoadCursor(NULL,IDC_WAIT));
// sSql.Format("DRIVER={%s};DSN='';FIRSTROWHASNAMES=7;READONLY=FALSE;CREATE_DB=\"%s\";DBQ=%s",sDriver, sFile, sFile);
sSql.Format("DRIVER={%s};DSN='';FIRSTROWHASNAMES=7;READONLY=FALSE;CREATE_DB=\"%s\";DBQ=%s",sDriver, sFile, sFile);
// MessageBox(NULL,sSql,sSql,MB_OK);
TRY{
if( database.OpenEx(sSql,CDatabase::noOdbcDialog) )
{
if(MzF.nScanType==SECTION_TYPE_XY)
{
sSql.Format("CREATE TABLE Z%d ( 序号 LONG,Y坐标 SMALLINT",MzF.nSheetNum);
}
else if(MzF.nScanType==SECTION_TYPE_XZ)
{