セル内の余白を設定したい
対象製品
SPREAD for ASP.NET 8.0J
詳細
Marginプロパティにより、セルの余白を設定することができます。
◎サンプルコード(VB)
◎サンプルコード(C#)
◎サンプルコード(VB)
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If IsPostBack Then
Return
End If
Dim i As Integer
Dim j As Integer
' テストデータの設定
For i = 0 To FpSpread1.ActiveSheetView.RowCount - 1
For j = 0 To FpSpread1.ActiveSheetView.ColumnCount - 1
FpSpread1.ActiveSheetView.Cells(i, j).Value = "R=" + i.ToString() + " C=" + j.ToString()
Next
Next
Dim mg As New FarPoint.Web.Spread.Inset(3, 0, 3, 0)
' 余白の設定をシートに適用
FpSpread1.ActiveSheetView.DefaultStyle.Margin = mg
' 余白の設定をB2セルに適用
'FpSpread1.ActiveSheetView.Cells(1, 1).Margin = mg
End Sub
If IsPostBack Then
Return
End If
Dim i As Integer
Dim j As Integer
' テストデータの設定
For i = 0 To FpSpread1.ActiveSheetView.RowCount - 1
For j = 0 To FpSpread1.ActiveSheetView.ColumnCount - 1
FpSpread1.ActiveSheetView.Cells(i, j).Value = "R=" + i.ToString() + " C=" + j.ToString()
Next
Next
Dim mg As New FarPoint.Web.Spread.Inset(3, 0, 3, 0)
' 余白の設定をシートに適用
FpSpread1.ActiveSheetView.DefaultStyle.Margin = mg
' 余白の設定をB2セルに適用
'FpSpread1.ActiveSheetView.Cells(1, 1).Margin = mg
End Sub
◎サンプルコード(C#)
protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack)
{
return;
}
int i = 0;
int j = 0;
// テストデータの設定
for (i = 0; i <= FpSpread1.ActiveSheetView.RowCount - 1; i++)
{
for (j = 0; j <= FpSpread1.ActiveSheetView.ColumnCount - 1; j++)
{
FpSpread1.ActiveSheetView.Cells[i, j].Value = "R=" + i.ToString() + " C=" + j.ToString();
}
}
FarPoint.Web.Spread.Inset mg = new FarPoint.Web.Spread.Inset(3, 0, 3, 0);
// 余白の設定をシートに適用
FpSpread1.ActiveSheetView.DefaultStyle.Margin = mg;
// 余白の設定をB2セルに適用
//FpSpread1.ActiveSheetView.Cells[1, 1].Margin = mg;
}
{
if (IsPostBack)
{
return;
}
int i = 0;
int j = 0;
// テストデータの設定
for (i = 0; i <= FpSpread1.ActiveSheetView.RowCount - 1; i++)
{
for (j = 0; j <= FpSpread1.ActiveSheetView.ColumnCount - 1; j++)
{
FpSpread1.ActiveSheetView.Cells[i, j].Value = "R=" + i.ToString() + " C=" + j.ToString();
}
}
FarPoint.Web.Spread.Inset mg = new FarPoint.Web.Spread.Inset(3, 0, 3, 0);
// 余白の設定をシートに適用
FpSpread1.ActiveSheetView.DefaultStyle.Margin = mg;
// 余白の設定をB2セルに適用
//FpSpread1.ActiveSheetView.Cells[1, 1].Margin = mg;
}
キーワード
外観