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

Free Support Forum - aspose.com

cell.getText() returns the code portion of the field rather than the embedded field result

When a cell contains a MACROBUTTON field, cell.getText() returns the code portion of the field rather than the embedded field result.
For example: MACROBUTTON tag [1]
What is the prescribed way to get the full display text.
Thanks

Hello

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request. Each field in MS Word consists of FieldStart, FieldSeparator, FieldEnd nodes and Run nodes, which represent field code and field value (displayed text). So in MS Word document field looks like the following:

[FieldStart]here is field code[FieldSeparator]here is field value[FieldEnd]

In this case to get a value of a field you should use cell.ToTxt(); method. Please see the following link for more information:

http://www.aspose.com/documentation/.net-components/aspose.words-for-.net-and-java/howto-extract-text-only.html

Best regards,

Thanks Andrey.
Could the internal handling of a macrobutton result be in error?
From: http://support.microsoft.com/kb/78835
The rtf for a macrobutton field is: {MACROBUTTON macroName buttonText}
When you display the result of the MACROBUTTON field, either the text or graphic that you specified as the buttonText instruction is displayed.
In the case of plain text buttonText, the result (in word) is the buttonText. Hence, the aspose result for a macrobutton field with plain buttonText should be the buttonText (when it is text) .
Example : "Click {MACROBUTTON macroName here}"
Using Cell.toTxt() on the above rtf will return "Click" instead of "Click here"
Using Cell.getText() returns "Click MACROBUTTON macroName here
The only solution that I see is to continue to use Cell.getText() and then manually remove the unwanted portions of a macrobutton field code.

Hello

Thank you for additional information. I managed to reproduce the problem on my side. Your request has been linked to the appropriate issue. You will be notified as soon as it is fixed. As a workaround, I think, you can use DocumentVisitor to get text. Please follow the link to learn more

http://www.aspose.com/documentation/.net-components/aspose.words-for-.net-and-java/howto-extract-content-using-documentvisitor.html

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Hope this helps you.

Best regards,

The issues you have found earlier (filed as WORDSNET-3247) have been fixed in this .NET update and this Java update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.