c 匯出2007格式的Excel的連線字串

2022-02-25 03:16:30 字數 444 閱讀 8704

上次做了個匯出excel檔案的客戶端軟體,沒有注意到:當開啟2007版的excel時提示錯誤「外部表不是預期的格式」,剛才網上蕩了點資料,改了一下連線字串,問題解決了:

把:string strconn = string.format("provider=microsoft.jet.oledb.4.0;data source='" + excel_filepath + "';extended properties='excel 8.0;hdr=yes;imex=1'");//第一行作為列  

改為了:

string strconn = string.format("provider=microsoft.ace.oledb.12.0;;data source='" + excel_filepath + "';extended properties='excel 8.0;hdr=yes;imex=1'");//第一行作為列

採用UTF 8格式匯出Excel存在亂碼解決方法

目前我們開發excel匯出時,多數使用exporttoexcelcommon類匯出excel,通常情況下不會產生亂碼,但在某些時候還是會產生亂碼。解決方法很簡單,只需要在exporttoexcel 方法中多加一句 即可,exporttoexcel 方法如下 設定輸出檔案型別為excel檔案。注意上述...

VC 匯出的格式 Excel

cfunclistctrl thectrl funclist cheaderctrl hdctrl thectrl.getheaderctrl char text 256 int hcount hdctrl getitemcount hditem hcol cstring str 50 for in...

c入門 1 格式

1!常量 d 稱為格式符 輸出有符號十進位制數 printf d d n 100,40 100 40 printf d d n 0144,040 100 32 printf d d n 0144,040 結果為d 32 printf d d n 0174,20 124 20 printf d d n...