ReportX技巧(8)輸入輸出EXCEL

2021-04-15 01:43:49 字數 1621 閱讀 5002

reportx關於匯入匯出excel的函式共有三個exportexcel以二進位制方式匯出、exportexcelole以ole方式匯出、importexcelole以ole方式匯入,下面具體講一下三個函式的用法。

exportexcel  (二進位制方式輸出)

exportexcel (bstr afilename, bstr asheetname, variant_bool adisplayvalue)

afilename:匯出檔案的路徑和名稱;

asheetname:匯出excel的表頁名,因為reportx只有乙個表頁,匯出的excel也只有乙個表頁;

adisplayvalue:adisplayvalue=true表示匯出的是reportx單元格的顯示值,即所見即所得,但這種方式不匯出單元格格式;adisplayvalue=false匯出的是reportx單元格的真實值。比如:單元格的formattype=1(數字),formattext="0.00",在這個單元格內寫入10.001,如果adisplayvalue=true則匯出10.00,單元格格式是「常規」;adisplayvalue=false則匯出10.001,單元格格式是「數字」「0.00」,在excel的介面上還會是10.00。

這種方式是按excel的格式以二進位制方式寫入,速度非常快。

exportexcelole

exportexcelole (bstr afilename, long acol1, long arow1, long col2, long row2, bstr asheetname, variant_bool aoletext)

afilename:匯出檔案的路徑和名稱;

acol1:起始區域列號;

arow1:起始區域行號;

acol2:終止區域列號;

arow2:終止區域行號;

asheetname:匯出excel的表頁名,因為reportx只有乙個表頁,匯出的excel也只有乙個表頁;

aoletext:aoletext=true表示只匯出文字,不匯出格式;aoletext=false會把所有excel支援的格式全部匯出。

這種方式是按ole方式匯出資料,aoletext=true的速度還可以,aoletext=false速度慢,但格式非常準確。

importexcelole

void importexcelole(bstr afilename, long acol1, long arow1, long acol2, long arow2, variant_bool aoletext)

afilename:匯入檔案的路徑和名稱;

acol1:起始列號

arow1:起始行號

acol2:終止列號

arow2:終止行號

aoletext:aoletext=true表示只匯入文字,不匯入格式;aoletext=false會把所有reportx支援的格式全部匯入。

這種方式是按ole方式匯入資料,aoletext=true的速度還可以,aoletext=false速度慢,但格式非常準確。

(需要登入

www.csdn.net

)或http://www.skycn.com/soft/22608.html

常用技巧 輸入輸出優化 輸入輸出外掛程式

我們知道cin cout是比較慢的,不過它們可以加速。在 中加入這兩句即可 std ios sync with stdio false std cin.tie 0 加速過後cin的速度與scanf的速度近似 當然,加速過後就不要混用print和cout,scanf和cin了。因為不同步,後果會很嚴重...

c c 輸入輸出技巧

c 小數的四捨五入問題 小數用 xf 輸出的話 是會自動四捨五入的 比如說double e 2.718,c 3.141 printf 2lf n e printf 2lf n c printf 2lf n int e 100 100.0 printf 2lf n int c 100 100.0 執行...

c c 輸入輸出技巧

c 小數的四捨五入問題 小數用 xf 輸出的話 是會自動四捨五入的 比如說double e 2.718,c 3.141 printf 2lf n e printf 2lf n c printf 2lf n int e 100 100.0 printf 2lf n int c 100 100.0 執行...