Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.

Wed Dec 07, 2016 9:04 pm

HI,

I´d like to know if it is possible to add a image or text Watermark to an ActiveDocument, even instead to open a document, add the watermark and then save it?

[email protected]
 
Posts: 4
Joined: Wed Dec 07, 2016 9:03 pm

Thu Dec 08, 2016 4:00 am

Hi,

Thanks for your inquiry.
Sorry that at present Spire.Doc doesn't support to create Macro, and it is not possible to add a image or text watermark without opening document in Spire.
Now Spire.Doc supports the way adding a image or text watermark as below, please check.
http://www.e-iceblue.com/Tutorials/Spir ... -Word.html
If there is any question, welcome to get it back to us.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Thu Dec 08, 2016 5:30 pm

Hi Betsy,

Sorry If I can´t be clear in my question, but I don´t want create a macro. I wnat to know if it is possible apply watermark in runtime mode. I´ll use the excerpt from the code below to try to better explain my question:

Instead of:

Dim document As New Document("C:\Test.docx")

Dim txtWatermark As TextWatermark = New TextWatermark
txtWatermark.Text = "Microsoft"
txtWatermark.FontSize = 90
txtWatermark.Layout = WatermarkLayout.Diagonal
document.Watermark = txtWatermark

Could do:

Dim document As New Document(Me.Application.ActiveDocument)

Dim txtWatermark As TextWatermark = New TextWatermark
txtWatermark.Text = "Microsoft"
txtWatermark.FontSize = 90
txtWatermark.Layout = WatermarkLayout.Diagonal
document.Watermark = txtWatermark

[email protected]
 
Posts: 4
Joined: Wed Dec 07, 2016 9:03 pm

Fri Dec 09, 2016 3:00 am

Hi,

Thanks for the detailed information.
At present Spire.Doc only supports to load files with following ways.
1)File path
2)Stream
If there is any question, welcome to get it back to us.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Fri Dec 09, 2016 3:21 pm

Hi Betsy,

Thanks again for the help.

Do you have any exemples using Stream to load files?

[email protected]
 
Posts: 4
Joined: Wed Dec 07, 2016 9:03 pm

Mon Dec 12, 2016 2:31 am

Hi,

Sorry for late reply as weekend.
Here is sample code for your reference.
Code: Select all
            //get the stream, you can get it via other way
            Stream stream = File.OpenRead(@"F:\testing\doc form\original document\8481.docx");
            Document doc = new Document(stream, FileFormat.Auto);


Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Mon Dec 12, 2016 9:12 pm

Thanks for all help Betsy.

[email protected]
 
Posts: 4
Joined: Wed Dec 07, 2016 9:03 pm

Tue Dec 13, 2016 1:33 am

Hi,

Thanks for your response.
Welcome to write to us for further question. We are here for help.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Return to Spire.Doc