private void Form1_Load(object sender, System.EventArgs e)
{
fpSpread1.ActiveSheet.RowCount = 30;
fpSpread1.ActiveSheet.ColumnCount = 15;
fpSpread1.ActiveSheet.DefaultStyle.CellType = new FarPoint.Win.Spread.CellType.NumberCellType();
fpSpread1.ActiveSheet.DefaultStyle.ForeColor = Color.LightGray;
for (int i = 0; i <= fpSpread1.ActiveSheet.RowCount -1 ; i++)
{
for (int j = 0; j <= fpSpread1.ActiveSheet.ColumnCount -1 ; j++)
{
fpSpread1.ActiveSheet.SetValue(i, j, i + j);
}
}
}
private void button1_Click(object sender, System.EventArgs e)
{
//印刷プレビュー画面を表示します
fpSpread1.ActiveSheet.PrintInfo.Preview = true;
//横向きで印刷します
fpSpread1.ActiveSheet.PrintInfo.Orientation = FarPoint.Win.Spread.PrintOrientation.Landscape;
//シートを中央に印刷します
fpSpread1.ActiveSheet.PrintInfo.Centering = FarPoint.Win.Spread.Centering.Both;
//不透明度を30にします
fpSpread1.ActiveSheet.PrintInfo.Opacity = 30;
//アクティブシート印刷します
fpSpread1.PrintSheet(fpSpread1.ActiveSheet);
}
private void fpSpread1_PrintBackground(object sender, FarPoint.Win.Spread.PrintBackgroundEventArgs e)
{
//先頭ページのみを対象とします
if (e.PageNumber == 1)
{
//透かしイメージを取得します
FarPoint.Win.Picture pic = new FarPoint.Win.Picture(Image.FromFile("画像ファイルパス名"), FarPoint.Win.RenderStyle.StretchAndScale);
pic.AlignHorz = FarPoint.Win.HorizontalAlignment.Center;
pic.AlignVert = FarPoint.Win.VerticalAlignment.Center;
//イメージを出力します
pic.Paint(e.Graphics, e.SheetRectangle);
}
}
private void fpSpread1_PrintPreviewShowing(object sender, FarPoint.Win.Spread.PrintPreviewShowingEventArgs e)
{
//表示倍率32%で印刷プレビュー画面を表示します
e.PreviewControl.Zoom = 0.32;
}
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
FpSpread1.ActiveSheet.RowCount = 30
FpSpread1.ActiveSheet.ColumnCount = 15
FpSpread1.ActiveSheet.DefaultStyle.CellType = New FarPoint.Win.Spread.CellType.NumberCellType
FpSpread1.ActiveSheet.DefaultStyle.ForeColor = Color.LightGray
For i As Integer = 0 To FpSpread1.ActiveSheet.RowCount - 1
For j As Integer = 0 To FpSpread1.ActiveSheet.ColumnCount - 1
FpSpread1.ActiveSheet.SetValue(i, j, i + j)
Next
Next
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'印刷プレビュー画面を表示します
FpSpread1.ActiveSheet.PrintInfo.Preview = True
'横向きで印刷します
FpSpread1.ActiveSheet.PrintInfo.Orientation = FarPoint.Win.Spread.PrintOrientation.Landscape
'シートを中央に印刷します
FpSpread1.ActiveSheet.PrintInfo.Centering = FarPoint.Win.Spread.Centering.Both
'不透明度を30にします
FpSpread1.ActiveSheet.PrintInfo.Opacity = 30
'アクティブシート印刷します
FpSpread1.PrintSheet(FpSpread1.ActiveSheet)
End Sub
Private Sub FpSpread1_PrintBackground(ByVal sender As Object, ByVal e As FarPoint.Win.Spread.PrintBackgroundEventArgs) Handles FpSpread1.PrintBackground
'先頭ページのみを対象とします
If e.PageNumber = 1 Then
'透かしイメージを取得します
Dim pic As New FarPoint.Win.Picture(Image.FromFile("画像ファイルパス名"), FarPoint.Win.RenderStyle.StretchAndScale)
pic.AlignHorz = FarPoint.Win.HorizontalAlignment.Center
pic.AlignVert = FarPoint.Win.VerticalAlignment.Center
'イメージを出力します
pic.Paint(e.Graphics, e.SheetRectangle)
End If
End Sub
Private Sub FpSpread1_PrintPreviewShowing(ByVal sender As Object, ByVal e As FarPoint.Win.Spread.PrintPreviewShowingEventArgs) Handles FpSpread1.PrintPreviewShowing
'表示倍率32%で印刷プレビュー画面を表示します
e.PreviewControl.Zoom = 0.32
End Sub