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.

Thu Jun 26, 2014 1:37 pm

Hi,

I am converting from interop word to spire docs. What is the equivalent in code for spire docs in vb.net for the following:

ActiveDocument.Select()
ActiveDocument.Windows.Item(1).Selection.HomeKey()
Critical = ActiveDocument.Windows.Item(1).Selection.Font.ColorIndex = Interop.Word.WdColorIndex.wdAuto or
Critical = ActiveDocument.Windows.Item(1).Selection.Font.ColorIndex = red

stevenheggie
 
Posts: 60
Joined: Tue Jun 24, 2014 10:32 am

Fri Jun 27, 2014 7:55 am

Hello,

Thanks for your inquiry.
There are some codes for your reference.
Code: Select all
Document document = new Document();
document.LoadFromFile("test.docx");
TextSelection[] text = document.FindAllString("test", false, true);
foreach (TextSelection seletion in text)
            {
                seletion.GetAsOneRange().CharacterFormat.TextColor = Color.Red;
            }

Feel free to contact us any time if you need further help or have some other issue or queries, we will be happy to assist you soon.
Sincerely,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Fri Jun 27, 2014 9:06 am

Hi,

That works fine.

Also how would I find the automatic colour of the word document.

As I will need to convert the following:
ActiveDocument.Windows.Item(1).Selection.Font.ColorIndex = Interop.Word.WdColorIndex.wdAuto

stevenheggie
 
Posts: 60
Joined: Tue Jun 24, 2014 10:32 am

Mon Jun 30, 2014 6:14 am

Hello,

Please set the text color as empty like this.
Code: Select all
seletion.GetAsOneRange().CharacterFormat.TextColor = Color.Empty;


If there are any questions, welcome to get it back to us.
Sincerely,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Mon Jun 30, 2014 9:14 am

Hi,

That's great works fine, thank you.

stevenheggie
 
Posts: 60
Joined: Tue Jun 24, 2014 10:32 am

Tue Jul 01, 2014 1:13 am

Hello,

Thanks for your response. Feel free to contact us any time if you need further help or have some other issue or queries, we will be happy to assist you soon.

Sincerely,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Return to Spire.Doc

cron