Weired behaviour of Aspose.words

I was testing the merging doc functionality of Aspose.Words component of .net platform. when I used the table of content functionality, this component inserting table of component on first page and their references on related pages in red color and some with bold fonts (weired behaviour) with following message.

Evaluation Only. Created with Aspose.Words. Copyright 2003-2011 Aspose Pty Ltd.
Manual:-My Manual
Chapter:-Chap1
Policy:-P2
Document:- Doc1.doc
Evaluation Only. Created with Aspose.Words. Copyright 2003-2011 Aspose Pty Ltd.
My question is that if I will use the licenced version still the references will be in red color/ bold fonts? And still it will say Created with Aspose.words.

Please reply soon so I can make decision in timely mannerv

Hi Bal,

Sorry for the inconvenience faced. It seems there is some license implementation issue in your code so that’s why you are getting evaluation watermark. Please add following code accordingly to your license path/settings before creating instance of Document. Hopefully your issue will be resolved.

If your issue persist then please share your code and license file via email, using contact tab on post. So we have a closer look into the issue and suggest you accordingly.

string licPath = (@"C:\aspose\License");
License license = new License();
license.SetLicense(licPath + "Aspose.Word.lic");

Please feel free to contact us for any further assistance.

Best Regards,

Thanks for your replay. I have an other question…

when I used the table of content functionality, aspose.words component inserts table of content on first page and their references on related pages. Is it possible we can hide the references, so we just see the table of content and my own text without references inserted by control?

Hi Bal,

Thanks for your inquiry. To hide reference page number from table of contents you can use \n switch as following. Hopefully it will serve the purpose.

builder.InsertTableOfContents("\o "1-1" \h \z \n \u");

Please feel free to contact us for any further assistance.

Best Regards,

Hi,

I think you did not understand the my question. again here is the question…

when I used the table of content functionality, aspose.words component inserts table of content on first page and their references on related pages. Is it possible we can hide the references, so we just see the table of content and my own text without references inserted by control?when I used the table of content functionality, aspose.words component inserts table of content on first page and their references on related pages. Is it possible we can hide the references, so we just see the table of content and my own text without references inserted by control?for example…

Table of Contents
MyManual… 3

so the above table of contents page is on page1 and it also insert the word MyManual on page 3. I now I just want to Hide the word MyManual from page3. and keep in page1. how to do it?

Hi Bal,

Please accept my apology for being on different nodes. Table of content functionality inserts table of contents on the desired place and creates references (hyperlink) to the respective associated headings and page numbers.

To achieve your requirements, the ConvertFieldsToStaticText method will be helpful to achieve your requirements. The FieldHelper class provides this static method to convert fields of a particular type to static text. You can replace references with static text in TOC, both headings and page numbers by using this method. Please refer to the following code snippet. Hopefully it will serve you purpose.

Document doc = new Document();
// Create a document builder to insert content with into document.
DocumentBuilder builder = new DocumentBuilder(doc);
builder.InsertTableOfContents("\o "1-1" \z \u");
builder.InsertBreak(BreakType.SectionBreakNewPage);
builder.ParagraphFormat.StyleIdentifier = StyleIdentifier.Heading1;
builder.Writeln("");
builder.Writeln("Heading 1");
builder.ParagraphFormat.StyleIdentifier = StyleIdentifier.Heading2;
builder.Writeln("Heading 1.1");
builder.Writeln("Heading 1.2");
builder.ParagraphFormat.StyleIdentifier = StyleIdentifier.Heading1;
builder.Writeln("Heading 2");
builder.Writeln("Heading 3");
builder.ParagraphFormat.StyleIdentifier = StyleIdentifier.Heading2;
builder.Writeln("Heading 3.1");
builder.ParagraphFormat.StyleIdentifier = StyleIdentifier.Heading3;
builder.Writeln("Heading 3.1.1");
builder.Writeln("Heading 3.1.2");
builder.Writeln("Heading 3.1.3");
// Call the method below to update the TOC.
doc.UpdateFields();
// Call the ConvertFieldsToStaticText() method to replace Fields with Static text.
FieldsHelper.ConvertFieldsToStaticText(doc, FieldType.FieldHyperlink);
FieldsHelper.ConvertFieldsToStaticText(doc, FieldType.FieldPageRef);
doc.Save(MyDir + "Toc out.doc");

Please feel free to contact us for any further assistance.

Best Regards,