私はこのシートをと呼んでおり、そのヘッダーを灰色にします。Excel細胞の着色
protected void btnExcel_OnClick(object sender, EventArgs e)
{
var ex = new Aspose.Cells.Workbook();
ex.Worksheets.Clear();
Aspose.Cells.Worksheet ws = ex.Worksheets.Add("Export");
ws.Cells.ImportTable(Export.GetExportList(GetWhereClause(), ConfigurationManager.AppSettings();
ws.Cells[0, 0].PutValue("A");
ws.Cells[0, 1].PutValue("B");
ws.Cells[0, 2].PutValue("C");
ws.Cells[0, 3].PutValue("D");
ws.Cells[0, 4].PutValue("E");
var style = ws.Cells.Rows[0].Style;
style.Font.IsBold = true;
ws.Cells.Rows[0].ApplyStyle(style, new StyleFlag { FontBold = true });
ex.Save(string.Format("Export_{0}.xlsx", DateTime.Now.ToString("yyyyMMdd_HHmmss")), FileFormatType.Excel2007Xlsx, SaveType.OpenInExcel, Response);
}
私もボタンのコードが含まれていました。 は、ここでは、コードです。 私はこのような何かを試してみました:
style.BackgroundColor = Color.DarkGrey;
または
ws.Cells[0, 0].Style.BackgroundColor = Color.DarkGrey;
そして私は
.Interior
method.Nothingの作品を持っていません。私に何ができる?ドキュメントから
「何もしない」とはどういう意味ですか?何がうまくいかない? – haindl
スタイルをセルに個別に設定しようとしましたか?このようにws.Cells [0,0] .SetStyle(style); –
@haindl私が上で試したコード行。色はまったく表示されません。 –