本文整理汇总了C#中Aspose.Save方法的典型用法代码示例。如果您正苦于以下问题:C# Aspose.Save方法的具体用法?C# Aspose.Save怎么用?C# Aspose.Save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Aspose
的用法示例。
在下文中一共展示了Aspose.Save方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Print
//ExStart
//ExId:XpsPrint_PrintDocument
//ExSummary:Convert an Aspose.Words document into an XPS stream and print.
/// <summary>
/// Sends an Aspose.Words document to a printer using the XpsPrint API.
/// </summary>
/// <param name="document"></param>
/// <param name="printerName"></param>
/// <param name="jobName">Job name. Can be null.</param>
/// <param name="isWait">True to wait for the job to complete. False to return immediately after submitting the job.</param>
/// <exception cref="Exception">Thrown if any error occurs.</exception>
public static void Print(Aspose.Words.Document document, string printerName, string jobName, bool isWait)
{
if (document == null)
throw new ArgumentNullException("document");
// Use Aspose.Words to convert the document to XPS and store in a memory stream.
MemoryStream stream = new MemoryStream();
document.Save(stream, Aspose.Words.SaveFormat.Xps);
stream.Position = 0;
Print(stream, printerName, jobName, isWait);
}
示例2: SaveWorkbook
/// <summary>
/// 儲存 Excel 報表。
/// </summary>
/// <param name="workbook">要儲存的報表物件</param>
/// <param name="filename">儲存的檔案名稱</param>
public static void SaveWorkbook(Aspose.Cells.Workbook workbook, string filename)
{
string path = CreatePath(filename, ".xls");
try
{
workbook.Save(path);
OpenFile(path, path);
}
catch (Exception ex)
{
//MsgBox.Show("儲存失敗" + ex.Message);
}
}
示例3: Save
/// <summary>
/// 目前僅支援 Aspose.Cells 報表。
/// </summary>
/// <param name="document">要儲存的報表物件。</param>
/// <param name="fileFullName">儲存的檔案名稱,請記得加入副檔名(.xls)。</param>
/// <param name="openAfterSave">產生完報表是否由程式開啟。批次產生報表時,務必傳入 false。</param>
/// <param name="type">目前僅支援 DocumentType.HSSFWorkbook,未來將支援 DocumentType.PDF。</param>
public static void Save(Aspose.Cells.Workbook document, string fileFullName, bool openAfterSave, DocumentType type)
{
try
{
document.Save(fileFullName);
if (openAfterSave)
Open(fileFullName);
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
示例4: saveDoc
//METHODS
//method for saving document
private static void saveDoc(Aspose.Words.Document document, string outputFile)
{
try
{
document.Save(outputFile);
writeToLog("Temporary document saved " + outputFile.ToString());
}
catch (Exception e)
{
Console.WriteLine("Application PDBOT failed with error: " + e.StackTrace);
writeToLog("Error saving temporary document " + e.StackTrace);
Console.ReadKey();
}
finally
{
document = null;
}
}