Aspose.Cells

Aspose.Cells

Aspose.Cells是一款功能強大的Excel文檔處理和轉換控制項,開發人員和客戶電腦無需安裝Microsoft Excel也能在應用程式中實現類似Excel的強大數據管理功能,支持所有Excel格式類型的操作,在沒有Microsoft Excel的環境下,用戶也可為其應用程式嵌入類似Excel的強大數據管理功能。Aspose.Cells可以對每一個具體的數據,表格和格式進行管理,在各個層面導入圖像,套用複雜的計算公式,並將應用程式中的表格保存為各種格式等。

基本介紹

  • 中文名:Aspose.Cells
  • 軟體類別:國外軟體 / 表格類 
  • 軟體語言:英文 
  • 目前最新版本:17.3.0
軟體信息,公司簡介,產品概述,常見用途,使用方式,

軟體信息

軟體類別:國外軟體 / 表格類
軟體語言:英文
平台:.NET, Java, SharePoint, SQL Reporting Services, JasperReports
目前最新版本:17.3.0
更新日期:2017-4-10

公司簡介

Aspose Pty Ltd 於2002年3月在澳大利亞悉尼創建。Aspose一直致力於成為全球最大的.Net 組件提供商,為全球.NET 程式設計師提供最豐富的選擇。數十個國家的數千機構選擇了Aspose的產品,這包括微軟、IBM、普華永道、安永、杜邦、希爾頓酒店、讀者文摘、美洲銀行、波音、西門子等等。

產品概述

Aspose.Cells是一個廣受讚譽的電子表格組件,支持所有Excel格式類型的操作,用戶無需依靠Microsoft Excel也可為其應用程式嵌入讀寫和處理Excel數據表格的功能。Aspose.Cells可以導入和導出每一個具體的數據,表格和格式,在各個層面導入圖像,套用複雜的計算公式,並將Excel的數據保存為各種格式等等---完成所有的這一切功能都無需使用Microsoft Excel 和Microsoft Office Automation。

常見用途

創建Excel儀錶盤,結合圖表和數據透視表
高保真Excel呈現和印刷
從Excel電子表格中導入數據
數據導出到Excel電子表格
電子表格操作/編輯
電子表格轉換

使用方式

1, 下載Aspose.Cells.dll 。在項目或者網站中添加引用Aspose.Cells.dll
Aspose.Cells(支持64位系統)
Aspose.Cells.支持64位系統。可以很方便的操作Excel...在項目或者網站中添加引用 Aspose.Cells.dll
1, 下載Aspose.Cells.dll 。在項目或者網站中添加引用Aspose.Cells.dll
Code:
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Aspose.Cells;
///<summary>
///AsposeExcel 的摘要說明
///</summary>
publicclassAsposeExcel
{
privatestring outFileName = "";
privatestring fullFilename = "";
privateWorkbook book = null;
privateWorksheet sheet = null;
publicAsposeExcel(string outfilename, string tempfilename)//導出構造數
{
outFileName = outfilename;
book = newWorkbook();
//book.Open(tempfilename);這裡我們暫時不用模板
sheet = book.Worksheets[0];
}
publicAsposeExcel(string fullfilename)//導入構造數
{
fullFilename = fullfilename;
// book = newWorkbook();
//book.Open(tempfilename);
//sheet =book.Worksheets[0];
}
privatevoid AddTitle(stringtitle, int columnCount)
{
sheet.Cells.Merge(0, 0, 1,columnCount);
sheet.Cells.Merge(1, 0, 1,columnCount);
Cellcell1 = sheet.Cells[0, 0];
cell1.PutValue(title);
cell1.Style.HorizontalAlignment = TextAlignmentType.Center;
cell1.Style.Font.Name = "黑體";
cell1.Style.Font.Size = 14;
cell1.Style.Font.IsBold = true;
Cellcell2 = sheet.Cells[1, 0];
cell1.PutValue("查詢時間:" + DateTime.Now.ToLocalTime());
cell2.SetStyle(cell1.Style);
}
privatevoid AddHeader(DataTabledt)
{
Cellcell = null;
for (int col = 0; col < dt.Columns.Count; col++)
{
cell = sheet.Cells[0, col];
cell.PutValue(dt.Columns[col].ColumnName);
cell.Style.Font.IsBold = true;
}
}
privatevoid AddBody(DataTabledt)
{
for (int r = 0; r < dt.Rows.Count; r++)
{
for(int c = 0; c < dt.Columns.Count; c++)
{
sheet.Cells[r + 1,c].PutValue(dt.Rows[r][c].ToString());
}
}
}
//導出------------下一篇會用到這個方法
publicBoolean DatatableToExcel(DataTabledt)
{
Booleanyn = false;
try
{
//sheet.Name= sheetName;
//AddTitle(title,dt.Columns.Count);
//AddHeader(dt);
AddBody(dt);
sheet.AutoFitColumns();
//sheet.AutoFitRows();
book.Save(outFileName);
yn = true;
returnyn;
}
catch (Exception e)
{
returnyn;
// throwe;
}
}
publicDataTable ExcelToDatatable()//導入
{
Workbookbook = newWorkbook();
book.Open(fullFilename);
Worksheetsheet = book.Worksheets[0];
Cellscells = sheet.Cells;
//獲取excel中的數據保存到一個datatable中
DataTabledt_Import = cells.ExportDataTableAsString(0, 0, cells.MaxDataRow + 1,cells.MaxDataColumn + 1, false);
// dt_Import.
returndt_Import;
}
}
Suport:760420057,即日起程

相關詞條

熱門詞條

聯絡我們