【解決方法】C#を使用してopenxmlを使用してWordファイルの表セルの前景色を変更する方法


OpenXML を使用して Word でテーブルを作成しました。テーブル セル (ヘッダー テーブル ヘッダー) をライト グレーで塗りつぶす必要があります。

どんな助けでも!!

前もって感謝します

私が試したこと:

TableRow tr1 = new TableRow();
TableCell tc11 = new TableCell();
TableCellProperties tcp = new TableCellProperties();
GridSpan gridSpan = new GridSpan();
gridSpan.Val = 11;
Paragraph p11 = new Paragraph();
ParagraphProperties pp11 = new ParagraphProperties();
pp11.Justification = new Justification() { Val = JustificationValues.Center };
Run r11 = new Run();
RunProperties rp11 = new RunProperties();
rp11.Bold = new Bold();
r11.Append(rp11);
r11.Append(new Text(""+"My text"));
p11.Append(r11);
tcp.Append(gridSpan);
tc11.Append(tcp);
tc11.Append(p11);
tr1.Append(tc11);
table1.Append(tr1);

解決策 1

自分でもよくわからなかったので、Google を使用しました。 Cを使用してopenxmlを使用してWordファイルの表セルの前景色を変更する方法 – Google 検索[^] そしてこれを見つけました: OpenXML TableCell の前景色と背景色を変更するにはどうすればよいですか?[^] … それは多くの最初の結果でした。 そうでない場合は、他のものを見てください。

コメント

タイトルとURLをコピーしました