How to remove or disable form field shading in Spire.Doc for Word documents?

15 Views Asked by At

document.Properties.FormFieldShading = false; does not work, I downloaded a Word document that still has form field shading. How can I resolve this issue? I am using FreeSpire.Doc in a .NET 6 project.

public byte[] DownFileWXPG(string ReportNO, string templdateName) {

WXPGFormat(ReportNO);

document = new Document(templdateName);
document.Properties.FormFieldShading = false;


SpireDocHelper.InsertTablemarkByText(document, 0, DicFuzhu1);
document.Properties.FormFieldShading = false;


using (MemoryStream memoryStream = new MemoryStream())
{                
    document.SaveToStream(memoryStream, FileFormat.Doc);
    
    byte[] bytes = memoryStream.ToArray();        

    return bytes;
}

}

public static void InsertTablemarkByText(Document document, int SectionIndex, Dictionary<string, string> CanshuDic) { var sectionFuzhu = document.Sections[SectionIndex].Body.FormFields;

foreach (FormField field in sectionFuzhu)
{
    try
    {
        field.OwnerParagraph.AppendText(CanshuDic[field.Name]);
    }
    catch { }
}           

}

0

There are 0 best solutions below