Hello,
Thanks for your post and below are my answers to your questions.
1). Regarding your requirement to show Watermark text on over content of image, our Spire.Doc supports setting transparent color for image to achieve it. Below is the sample code for your reference. If there is any question, please provide your original files as well as your desired effect of output for our reference, then we will look into it and guide you accordingly.
- Code: Select all
//load a document
Document document = new Document();
document.LoadFromFile(@"sample.docx");
//Set white color transparent
foreach (Paragraph paragraph in document.Sections[0].Paragraphs)
{
foreach (DocumentObject docObj in paragraph.ChildObjects)
{
if (docObj.DocumentObjectType == DocumentObjectType.Picture)
{
DocPicture picture = docObj as DocPicture;
picture.TransparentColor = Color.White;
}
}
}
//add txtWatermark
TextWatermark txtWatermark = new TextWatermark();
txtWatermark.Text = "this is a sample";
txtWatermark.FontSize = 45;
txtWatermark.Color = Color.Black;
txtWatermark.Layout = WatermarkLayout.Horizontal;
document.Watermark = txtWatermark;
//save file
document.SaveToFile("result.docx", Spire.Doc.FileFormat.Docx2013);
2). Please note that our Spire.Doc based on the MS Word, it isn't supported in MS word to set Watermark text position (like left,right and center). Thus, our Spire.Doc does not support it.
3). As for your requirement to change Watermark text position in Excel file and in Pdf file, please provide your sample files to help us further look into it. You could send them to us via email (
support@e-iceblue.com). Thanks in advance.
Besides, if you want to use two or more products in the same project, please use
Spire.Office instead and reference the DLLS you need to avoid the DLL version incompatibility.
Sincerely,
Lisa
E-iceblue support team