0
我想在C#中使用Open XML SDK創建一定數量的複選框。我會怎麼做?如何使用Open XML SDK在C#中創建複選框
實施例:
(Checkbox) - Shoes
(Checkbox) - Shirt
複選框計數也變化。我在閱讀模板文檔,然後進行編輯以返回。我有這樣的事情至今:
string documentText;
using (StreamReader reader ...)
{
documentText = reader.ReadToEnd();
}
string addClothes = "";
Run newCheckBox = GenerateRun();
foreach(var item in ClothesList)
{
addClothes = item.clothing;
//MY DILEMMA
documentText = documentText.Replace("##clothing##", newCheckBox + addClothes + "NewLine");
}
public Run GenerateRun()
{
Run run1 = new Run() { RsidRunProperties = "004C0D9A", RsidRunAddition = "00850FA5" };
FieldCode fieldCode1 = new FieldCode() { Space = SpaceProcessingModeValues.Preserve };
fieldCode1.Text = " FORMCHECKBOX ";
run1.Append(fieldCode1);
return run1;
}