原創|其它|編輯:郝浩|2012-09-06 09:43:36.000|閱讀 582 次
概述:在對Excel的操作中,我們經常用到工作簿合并,那么,Aspose.Cells是如何實現這一功能的呢?下面,我們就舉一個實例來為大家講解Aspose.Cells是如何將兩個包含圖像和圖表的工作簿合并為一個的。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
在對Excel的操作中,我們經常用到工作簿合并,那么,Aspose.Cells是如何實現這一功能的呢?下面,我們就舉一個實例來為大家講解Aspose.Cells是如何將兩個包含圖像和圖表的工作簿合并為一個的。
合并前:
工作簿1:PictureTest.xls
工作簿2: ChartTest.xls (2 worksheet)
我們將這兩個工作簿合并為一個:Combined.xls,代碼如下:
[C#]
//Define the first source
//Open the first excel file.
Workbook SourceBook1 = new Workbook("c:\\excels\\ChartTest.xls");
//Define the second source book.
//Open the second excel file.
Workbook SourceBook2 = new Workbook("C:\\excels\\PictureTest.xls");
//Combining the two workbooks
SourceBook1.Combine(SourceBook2);
//Save the target book file.
SourceBook1.Save("c:\\excels\\combined.xls");
[VB]
'Define the first source book.
'Open the first excel file.
Dim SourceBook1 As New Workbook("c:\excels\ChartTest.xls")
'Define the second source book.
'Open the second excel file.
Dim SourceBook2 As New Workbook("C:\excels\PictureTest.xls")
'Combining the two workbooks
SourceBook1.Combine(SourceBook2)
'Save the target book file.
SourceBook1.Save("c:\excels\combined.xls")
代碼運行后效果圖如下:
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn
文章轉載自:慧都控件網