.NET實(shí)現(xiàn)在網(wǎng)頁(yè)中預(yù)覽Office文件的3個(gè)方法(2)_.Net教程
推薦:asp.net中控制反轉(zhuǎn)怎么理解?對(duì)IOC的解釋為:Inversion of control is a common characteristic of frameworks, so saying that these lightweight containers are special because they use inversion of control is like saying my car is special because it has wheels. 我想對(duì)這一概念執(zhí)行
#region 1.02 Excel文件轉(zhuǎn)換為HTML文件 +(string sourceFileName, string targetFileName, string guid)
/// <summary>
/// Excel文件轉(zhuǎn)換為HTML文件
/// </summary>
/// <param name="sourceFileName">Excel文件路徑</param>
/// <param name="targetFileName">目標(biāo)路徑</param>
/// <returns>轉(zhuǎn)換是否成功</returns>
public static bool ConvertExcelToHtml(string sourceFileName, string targetFileName)
{
Souxuexiao.API.Logger.info(string.Format("準(zhǔn)備執(zhí)行Excel文件轉(zhuǎn)換為HTML文件,sourceFileName={0},targetFileName={1}",sourceFileName,targetFileName));
try
{
using (System.IO.Stream stream = new System.IO.FileStream(sourceFileName, System.IO.FileMode.Open, System.IO.FileAccess.Read, System.IO.FileShare.ReadWrite))
{
Aspose.Cells.Workbook workbook = new Workbook(stream);
workbook.Save(targetFileName, Aspose.Cells.SaveFormat.Html);
}
}
catch (Exception ex)
{
Souxuexiao.API.Logger.error(string.Format("Excel文件轉(zhuǎn)換為HTML文件ConvertExcelToHtml異常原因是:{0}", ex.Message));
}
return System.IO.File.Exists(targetFileName);
}
#endregion
#region 1.03 將PowerPoint文件轉(zhuǎn)換為PDF +ConvertPowerPointToPdf(string sourceFileName, string targetFileName)
/// <summary>
/// 將PowerPoint文件轉(zhuǎn)換為PDF
/// </summary>
/// <param name="sourceFileName">PPT/PPTX文件路徑</param>
/// <param name="targetFileName">目標(biāo)文件路徑</param>
/// <returns>轉(zhuǎn)換是否成功</returns>
public static bool ConvertPowerPointToPdf(string sourceFileName, string targetFileName)
{
Souxuexiao.API.Logger.info(string.Format("準(zhǔn)備執(zhí)行PowerPoint轉(zhuǎn)換PDF,sourceFileName={0},targetFileName={1}",sourceFileName,targetFileName));
try
{
using (System.IO.Stream stream = new System.IO.FileStream(sourceFileName, System.IO.FileMode.Open, System.IO.FileAccess.Read, System.IO.FileShare.ReadWrite))
{
Aspose.Slides.Pptx.PresentationEx pptx = new Aspose.Slides.Pptx.PresentationEx(stream);
pptx.Save(targetFileName, Aspose.Slides.Export.SaveFormat.Pdf);
}
}
catch (Exception ex)
{
Souxuexiao.API.Logger.error(string.Format("將PowerPoint文件轉(zhuǎn)換為PDFConvertExcelToHtml異常原因是:{0}", ex.Message));
}
return System.IO.File.Exists(targetFileName);
}
#endregion
分享:delphi選擇文件夾例子所需單元 示例代碼
- asp.net中控制反轉(zhuǎn)怎么理解?
- delphi選擇文件夾例子
- asp.net中C++單例實(shí)現(xiàn)問題分析
- 簡(jiǎn)單理解Web Service三種實(shí)現(xiàn)方式
- Asp.net中Ajax與JQuery的ready函數(shù)沖突怎么辦
- asp.net中Repeater控件用法筆記
- asp.net中導(dǎo)出excel數(shù)據(jù)的方法匯總
- Asp.Net 上傳圖片并生成高清晰縮略圖
- 服務(wù)器安全狗導(dǎo)致ASP.NET網(wǎng)站運(yùn)行出錯(cuò)的一個(gè)案例
- Asp.Net其他頁(yè)面如何調(diào)用Web用戶控件寫的分頁(yè)
- ASP.NET中上傳并讀取Excel文件數(shù)據(jù)示例
- asp.net SqlParameter如何根據(jù)條件有選擇的添加參數(shù)
.Net教程Rss訂閱編程教程搜索
.Net教程推薦
- 解析標(biāo)題太長(zhǎng)用省略號(hào)來代替簡(jiǎn)單辦法
- 怎樣防止ASP.NET按鈕的多次提交
- .Net教程之HTTP狀態(tài)碼200,301,302
- asp.net 圖片超過指定大小后等比例壓縮圖片的方法
- ajax.net對(duì)數(shù)據(jù)庫(kù)的插入實(shí)例
- 水晶易表調(diào)用C#的WebService,返回?cái)?shù)據(jù)集合的應(yīng)用分析
- 解析ASP.NET中C 和J#的混合應(yīng)用
- 關(guān)于.NET/C#/WCF/WPF 打造IP網(wǎng)絡(luò)智能視頻監(jiān)控系統(tǒng)的介紹
- ASP.NET2.0中控件的簡(jiǎn)單異步回調(diào)
- 怎樣實(shí)現(xiàn)MSMQ的消息加密
- 相關(guān)鏈接:
復(fù)制本頁(yè)鏈接| 搜索.NET實(shí)現(xiàn)在網(wǎng)頁(yè)中預(yù)覽Office文件的3個(gè)方法(2)
- 教程說明:
.Net教程-.NET實(shí)現(xiàn)在網(wǎng)頁(yè)中預(yù)覽Office文件的3個(gè)方法(2)
。