以下のサンプルでは プリンターからの出力は、Workbook.Save
によって生成された「output.pdf」と同じではありません。
//
using System.IO;
using Aspose.Cells;
using Aspose.Cells.Rendering;
namespace Aspose.Cells.Examples.CSharp.Files.Utility
{
public class AdvancedConversiontoPdf
{
public static void Run()
{
// ExStart:1
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
// Instantiate new workbook
Workbook workbook = new Workbook();
// Insert a value into the A1 cell in the first worksheet
workbook.Worksheets[0].Cells[0, 0].PutValue("●●●●●○○○○○1234567890●●●●●○○○○○ 様納入");
workbook.Worksheets[0].Cells.Columns[0].Width = 27;
workbook.Worksheets[0].Cells.Rows[0].Height = 30.54;
Style _style = workbook.CreateStyle();
_style.IsTextWrapped = true;
var _font = _style.Font;
_font.Name = "MS 明朝";
_font.Size = 9;
workbook.Worksheets[0].Cells[0,0].SetStyle(_style);
// Define PdfSaveOptions
PdfSaveOptions pdfSaveOptions = new PdfSaveOptions();
//CJK preferred word break.
pdfSaveOptions.DefaultEditLanguage = DefaultEditLanguage.CJK;
// Set the compliance type
//pdfSaveOptions.Compliance = PdfCompliance.PdfA1b;
// Save the file
workbook.Save(dataDir + "output.pdf", pdfSaveOptions);
workbook.Save(dataDir + "output.xlsx");
// ExEnd:1
ImageOrPrintOptions imgOpt = new ImageOrPrintOptions();
imgOpt.DefaultEditLanguage = DefaultEditLanguage.CJK;
WorkbookRender wr = new WorkbookRender(workbook, imgOpt);
//wr.ToPrinter("Microsoft Print to PDF");
wr.ToPrinter("Microsoft Print to PDF");
}
}
}