Possible to insert auto text defined in a template?

I’m using Aspose.Words for Java. I have an attached template with
some tables defined as auto text. Is it possible to insert these
tables into my document? I don’t see a way. Am I missing
something?



Thanks!

Abbie


The file was not attached due to some problem on the site. Please reattach the file.

Best regards,

I create a new document and attach a template to that document:

Document document = new Document();

document.setAttachedTemplate(documentPath);



The template has auto text entries defined in it. For example
“Filename and path” prints out the file name and path.



Is there any way to access these auto text entries, perhaps by name?



I’ve attached a basic template.



Thanks!


Autotext insertion is handled in different ways in MS Word. Some, but not all, of these autotext entries insert fields that are filled with corresponding data when updated in MS Word.

For example, 'Filename' and 'Filename and path' autotext insertion creates { FILENAME } field in the document. These fields can be created with Aspose.Words as well. For example,

// insert filename autotext

builder.InsertField("FILENAME", "");

builder.Writeln();

// insert filename and path autotext

builder.InsertField(@"FILENAME \p", "");

You need to update these fields in MS Word however to see the actual data. Aspose.Words does not update these fields.

As far as I can see, the template you have provided does not have any custom Autotext entries defined.

Aspose.Words currently does not have any API functions for dealing with Autotext options in general. If you have some scenario in which some custom Autotext options should be used or preserved in the resulting document please desribe it. I will check how it could be done with Aspose.Words. Maybe some workaround is possible.

Best regards,

I am building documents that have several tables in them. There
are several possible tables. Each document may include all of the
tables or some subset of them. The style of the tables may
change. Ideally, I’d like to have the empty tables defined
in a template as autotext.



The builder could then decide which tables it needs at run time.
It could insert these empty tables onto the document as autotext.
The builder would then populate the tables.



I’d like to avoid having the builder assemble the tables because they
may change over time and I don’t want to be updating this code every
time the table structure changes.



If you have a private email I can send you a copy of the template with the tables defined as autotext.



Thanks!






I have sent a contact e-mail in a private message.

Best regards,

Handling custom autotext entries is not available in our current API yet. You can use another approach however. The building blocks for documents generated in your application can be stored in the set of template documents - one in each. Or in one document, separated by section breaks and supplied with names in the first paragraph of each section for example, to provide named access.

If that suits you, I will assist you in building the prototype project.

Best regards,

After some discussion we’ve agreed on the 2nd option. I’ll email
you an updated template. Are the section breaks necessary?

Thanks!




Thanks for an updated template. Please give me 2 days to compose a prototype project. I will send it to you by e-mail.

Best regards,

I have sent the prototype project by e-mail. Please let me know if there is anything else I could help you with.

Best regards,

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


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