Word Automation/Search-Replace


#1

Hi,

I have currently have a solution which uses Microsoft Word in the server side.

Due to limitations, we have started evaluating server-side Microsoft Word replacements. Aspose offers most of the functionalities compared to other products in the market.

Our current (Word) solution uses Search and replace to replace text and formats the replaced text with bullets, different font types, numbering etc. On top of it, it also does Mail Merge.

Our business users creates the templates & places database fields as "Merge Fields" and places other custom fields as regular text in the following format. [#CUSTOMFIELD].

Aspose does Mail Merge very efficiently. I am currently looking for a solution which can Search and replace and top of it, format the replaced content with different font, bulleting & numbering.

Is there any function/method called "MoveToText()" in DocumentBuilder to acheive this functionality? If I can somehow, move to that particular position, I could format the content.

I would really appreciate any help in this regard.

thanks
-Balaji


#2

Thank you for the positive report about Aspose.Word work, but, as I said in the previous thread, you cannot change formatting of some arbitrary text in the document. If you knew which text must be replaced beforehand, you'd be able to place bookmarks at certain positions and use a workaround like that:


Document doc = new Document(@"D:\Tests\test.doc");

DocumentBuilder builder = new DocumentBuilder(doc);

doc.Range.Bookmarks["Blah"].Text = String.Empty;

builder.MoveToBookmark("Blah");

builder.Font.Size = 24;

builder.Font.Color = Color.ForestGreen;

builder.Writeln("TextToReplace");

doc.Save(@"D:\Tests\result.doc");