We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

{private } field code is causing problems

Hello,

I'm having a problem inserting a table of authorities into a word file that contains a {private } field code. There is something about the private field code that hides the inserted TOA, and I'm wondering if there is anything that I can do to show the TOA, other than remove the {private } field code.

I wrote a small sample application, with a test word document, to recreate the issue. Any insight on a property or some style that I can set that would show the TOA no matter what field codes exist in the document, would be very helpful.

Thanks,

Randall

Hi

Thanks for your inquiry. Have you tried to update fields in your output document? (ctrl+A and then press F9). Unfortunately Aspose.Words doesn’t update TOA fields. At the moment Aspose.Words can update the results of DOCPROPERTY and DOCVARIABLE fields only. See the following link.
http://www.aspose.com/Products/Aspose.Words/Api/Aspose.Words.Range.UpdateFields.html

Hope this helps.

Best regards.

Hi yes, my problem with "the missing TOA" is occurring after updating the TOA. The text seems to be hidden, after updating the TOA.

There is something about that {private } field code that is, perhaps, changing some property on the text of the TOA, and I'm wondering if aspose has a way to force text to always display.

-Randall

Hi

I updated fields in the UpdateField document and TOA is shown properly. I see this in the TOA.

Other Authorities

United States v. Cuervo
354 F.3d 969 (8th Cir. 2004) ...............................................................2

9

Fed. R. Civ. P. 12(c) ............................................................................1

Best regards.

Hi, thank you for looking at the issue. It sounds like you might have "Show Hidden Text" turned on in Microsoft word. After updating the field, make sure in your microsoft word options that you don't have the box for Hidden Text selected.

I'm using Microsoft word 2003, and I haven't tested in Word 2007.

-Randall

Hi

Sorry, I missed this. PRIVETE field is formatted as hidden text. I think that you can insert your TOA after Private Field. See the following code snippet.

Aspose.Words.Document doc = new Aspose.Words.Document("testFile.DOC");

string categoryNumberString;

Aspose.Words.DocumentBuilder docBuilder = new Aspose.Words.DocumentBuilder(doc);

//Move to start of second paragraph

docBuilder.MoveToParagraph(1, 0);

docBuilder.CurrentParagraph.ParagraphFormat.Style.Font.Hidden = false;

docBuilder.CurrentParagraph.ParagraphBreakFont.Hidden = false;

categoryNumberString = string.Format(@"TOA \h \c ""{0}""", 3);

docBuilder.InsertField(categoryNumberString, null);

categoryNumberString = string.Format(@"TOA \h \c ""{0}""", 9);

docBuilder.InsertField(categoryNumberString, null);

doc.Save("UpdateFile.doc");

Also you can remove PRIVATE field and set Font.Hidden=false.

Hope this helps.

Best regards.

Okay, thanks for looking into the issue. If I'm understanding you, there is no way to force text to display that is inserted before a private field code, is that correct?

I think we might be able to do a work around, with something like what you mentioned in that code.

-Randall

Hi

In your document when you use MoveToDocumentStart cursor is placed in the hidden paragraph (paragraph with PRIVATE field). That’s why inserted text will be hidden.

Also you can try doing the following.

Aspose.Words.Document doc = new Aspose.Words.Document("testFile.DOC");

string categoryNumberString;

Aspose.Words.DocumentBuilder docBuilder = new Aspose.Words.DocumentBuilder(doc);

docBuilder.MoveToDocumentStart();

docBuilder.CurrentParagraph.ParagraphFormat.Style.Font.Hidden = false;

docBuilder.CurrentParagraph.ParagraphBreakFont.Hidden = false;

categoryNumberString = string.Format(@"TOA \h \c ""{0}""", 3);

docBuilder.InsertField(categoryNumberString, null);

(docBuilder.CurrentParagraph.PreviousSibling as Paragraph).ParagraphFormat.Style.Font.Hidden = false;

categoryNumberString = string.Format(@"TOA \h \c ""{0}""", 9);

docBuilder.InsertField(categoryNumberString, null);

(docBuilder.CurrentParagraph.PreviousSibling as Paragraph).ParagraphFormat.Style.Font.Hidden = false;

doc.Save("UpdateFile.doc");

Best regards.

Okay Alexey,

Thanks for your help...it seems to work to insert the TOA after the private fieldcode. I couldn't get it to display by inserting the fieldcode at the beginning of the document.

-Randall