// PDF ファイルストリームの作成 using FileStream outputStream = new FileStream("CustomBorder.pdf", FileMode.Create); // 新規ワークブックの作成 var workbook = new GrapeCity.Documents.Excel.Workbook(); var templateFile = this.GetResourceStream("xlsx\\CustomBorderStyle.xlsx"); workbook.Open(templateFile); // PDFにエクスポートするボーダースタイルを設定 var pdfSaveOptions = new PdfSaveOptions(); var thinBorderSetting = new CustomBorderStyle { BorderWidth = 0.4 }; var middleBorderSetting = new CustomBorderStyle { BorderWidth = 1.5 }; var dashBorderSetting = new CustomBorderStyle { BorderWidth = 0.4, Dashes = new List<double> { 0.8, 0.8 } }; pdfSaveOptions.BorderOptions.Add(BorderLineStyle.Thin, thinBorderSetting); pdfSaveOptions.BorderOptions.Add(BorderLineStyle.Medium, middleBorderSetting); pdfSaveOptions.BorderOptions.Add(workbook.ActiveSheet.Range["B13"].Borders[BordersIndex.EdgeTop].LineStyle, dashBorderSetting); // ワークブックをPDFファイルとして保存 workbook.Save(outputStream, pdfSaveOptions);
' PDF ファイルストリームの作成 Dim outputStream = File.Create("CustomBorder.pdf") ' 新規ワークブックの作成 Dim workbook As New Workbook Dim templateFile = Me.GetResourceStream("xlsx\CustomBorderStyle.xlsx") workbook.Open(templateFile) ' PDFにエクスポートするボーダースタイルを設定 Dim pdfSaveOptions = New PdfSaveOptions() Dim thinBorderSetting = New CustomBorderStyle With { .BorderWidth = 0.4 } Dim middleBorderSetting = New CustomBorderStyle With { .BorderWidth = 1.5 } Dim dashBorderSetting = New CustomBorderStyle With { .BorderWidth = 0.4, .Dashes = New List(Of Double) From { 0.8, 0.8 } } pdfSaveOptions.BorderOptions.Add(BorderLineStyle.Thin, thinBorderSetting) pdfSaveOptions.BorderOptions.Add(BorderLineStyle.Medium, middleBorderSetting) pdfSaveOptions.BorderOptions.Add(workbook.ActiveSheet.Range("B13").Borders(BordersIndex.EdgeTop).LineStyle, dashBorderSetting) ' ワークブックをPDFファイルとして保存 workbook.Save(outputStream, pdfSaveOptions)