var s = ws.Cells[
7,
1].GetStyle();
s.ForegroundColor = Color.Cyan;
s.Pattern = BackgroundType.Solid;
ws.Cells[ 7,i+ 1].SetStyle(s);
s.ForegroundColor = Color.Cyan;
s.Pattern = BackgroundType.Solid;
ws.Cells[ 7,i+ 1].SetStyle(s);
其中特別注意,由於Excel 的背景色可能會有漸變效果,所以如果要設置純色的話務必設置在ForefroundColor上。
在Word中,如果使用Aspose.Word設置的顏色超出了Word的識別范圍,並且保存為較舊格式(doc)時,用新版的Word打開會提示文件可能含有惡意代碼。
此時只能使用安全顏色進行填充,不要用RGB自己組裝。