本文整理汇总了C#中LoadOptions.SetPaperSize方法的典型用法代码示例。如果您正苦于以下问题:C# LoadOptions.SetPaperSize方法的具体用法?C# LoadOptions.SetPaperSize怎么用?C# LoadOptions.SetPaperSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LoadOptions
的用法示例。
在下文中一共展示了LoadOptions.SetPaperSize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Run
public static void Run()
{
// ExStart:1
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
// Create a sample workbook and add some data inside the first worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
worksheet.Cells["P30"].PutValue("This is sample data.");
// Save the workbook in memory stream
MemoryStream ms = new MemoryStream();
workbook.Save(ms, SaveFormat.Xlsx);
ms.Position = 0;
// Now load the workbook from memory stream with A5 paper size
LoadOptions opts = new LoadOptions(LoadFormat.Xlsx);
opts.SetPaperSize(PaperSizeType.PaperA5);
workbook = new Workbook(ms, opts);
// Save the workbook in pdf format
workbook.Save(dataDir + "LoadWorkbookWithPrinterSize-a5_out.pdf");
// Now load the workbook again from memory stream with A3 paper size
ms.Position = 0;
opts = new LoadOptions(LoadFormat.Xlsx);
opts.SetPaperSize(PaperSizeType.PaperA3);
workbook = new Workbook(ms, opts);
// Save the workbook in pdf format
workbook.Save(dataDir + "LoadWorkbookWithPrinterSize-a3_out.pdf");
// ExEnd:1
}