Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim frmprint As Form2
frmprint = New Form2
Dim filter As String = "DF files(*.PDF)|*.PDF"
Dim fn As String = ""
' ファイル保存ダイアログ起動
Using sfd As New SaveFileDialog()
sfd.Filter = filter
sfd.FileName = "test"
If sfd.ShowDialog() = DialogResult.OK Then
fn = sfd.FileName
Else
Return
End If
End Using
' ◆PDF出力
frmprint.FpSpread1.ActiveSheet.PrintInfo.PrintToPdf = True
frmprint.FpSpread1.ActiveSheet.PrintInfo.PdfFileName = fn
frmprint.FpSpread1.PrintSheet(frmprint.FpSpread1.ActiveSheetIndex)
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Dim filter As String = "DF files(*.PDF)|*.PDF"
Dim fn As String = ""
' ファイル保存ダイアログ起動
Using sfd As New SaveFileDialog()
sfd.Filter = filter
sfd.FileName = "test"
If sfd.ShowDialog() = DialogResult.OK Then
fn = sfd.FileName
Else
Return
End If
End Using
' ◆PDF出力
FpSpr.ActiveSheet.PrintInfo.PrintToPdf = True
FpSpr.ActiveSheet.PrintInfo.PdfFileName = fn
FpSpr.PrintSheet(FpSpr.ActiveSheetIndex)
End Sub
End Class