Hello,
Thanks for your more information.
Sorry we have not received any attached documents from this post.
However, we suspected that your document paragraphs may have white background colors, as my attached "test.docx". You can refer to the code below to remove the background color, and then add the watermark to test again. If your problem persists after the test and your file exceeds the size limitation for attachment. You could upload your file to the DropBox or OneDrive and then share the download link with us. Thank you in advance.
- Code: Select all
Document document = new Document(@"test.docx");
foreach (Section section in document.Sections)
{
foreach (Paragraph paragraph in section.Paragraphs)
{
paragraph.Format.BackColor = Color.Empty;
foreach (DocumentObject paraChildObject in paragraph.ChildObjects)
{
if (paraChildObject.DocumentObjectType == DocumentObjectType.TextRange)
{
extRange textRange = (TextRange)paraChildObject;
textRange.CharacterFormat.TextBackgroundColor = Color.Empty;
}
}
}
}
//Insert text watermark.
InsertTextWatermark(document.Sections[0]);
//Save as docx file.
document.SaveToFile("Sample.docx", FileFormat.Docx);
}
private void InsertTextWatermark(Section section)
{
TextWatermark txtWatermark = new TextWatermark();
txtWatermark.Text = "E-iceblue";
txtWatermark.FontSize = 95;
txtWatermark.Color = Color.Blue;
txtWatermark.Layout = WatermarkLayout.Diagonal;
section.Document.Watermark = txtWatermark;
}
Sincerely,
Simple
E-iceblue support team
Login to view the files attached to this post.