MESCIUS SPREAD for ASP.NET 10.0J サンプルコード集
和暦を表示する

日付型セルのDateTimeFormatプロパティに、和暦が有効な日付書式を設定します。

実行例:

//日付書式にJapaneseCalendarを設定します
System.Globalization.DateTimeFormatInfo dinfo= new System.Globalization.CultureInfo("ja-JP").DateTimeFormat;
dinfo.Calendar = new System.Globalization.JapaneseCalendar();
//日付型セルに書式を設定します
FpSpread1.Cells[0, 1].CellType = new DateTimeCellType()
{
    DateTimeFormat=dinfo,               
    FormatString = "gg yy年M月d日"
};
FpSpread1.Cells[0, 1].Value = new DateTime(2016, 1, 23);
'日付書式にJapaneseCalendarを設定します
Dim dinfo As System.Globalization.DateTimeFormatInfo = New System.Globalization.CultureInfo("ja-JP").DateTimeFormat
dinfo.Calendar = New System.Globalization.JapaneseCalendar()
'日付型セルに書式を設定します
FpSpread1.Cells(0, 1).CellType = New DateTimeCellType() With {
    .DateTimeFormat = dinfo, _
    .FormatString = "gg yy年M月d日" _
}
FpSpread1.Cells(0, 1).Value = New DateTime(2016, 1, 23)

 

 


© MESCIUS inc. All rights reserved.