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

Free Support Forum - aspose.com

Content control support?

Hi there,

We’ve recently signed up to license Aspose and so far it’s working really well plugging some gaps for us in our product. But we think it could do a lot more for us.

We would like to better understand certain functions around Aspose’s support for the following:

  • Repeat content controls: are repeats supported? Can repeats be nested? Is it possible to repeat multiple controls that contain rich content (HTML converted), images, etc.?
  • Rich content controls: the HTML insertion process, does that support images? (i.e. base64 encoded) HTML Tables? Style conversion (e.g.

    converted to a paragraph block and styled with MyCustomStyle in the word document).

  • Conditionals using content controls: is it possible to perform conditionals on content control data? For example, checking a custom XML data store to see if a count of elements is greater than 0 to insert a section, etc. In docx4j, this is achieved through the OpenDoPE extension using XPath 1.0. If this is supported in Aspose.Words, does it use XPath/XLST or something else?
  • In-document cross-referencing support? (e.g. using page numbers, headers, header numbering)

Would it be possible to have a direct email to discuss some options around support/development?

Many thanks,
Dave.

@drcs,

Thanks for your inquiry.

Aspose.Words does support repeat content control while document conversion. However, Aspose.Words does not provide API to create repeat content control. We have already logged this feature as WORDSNET-12439 in our issue tracking system. We will inform you via this forum thread once this feature is available.

Yes, you can create rich text content control using Aspose.Words and insert images and HTML in it. You just need to move the cursor to the child node of content control and insert HTML and image using DocumentBuilder.

Could you please share some more detail about these two queries along with input and expected output documents? We will then provide you more information on this along with code.

Please note that we only provide support via forum. Please always post your queries in Aspose.Words’ forum.

Hi Tahir / support,

Thanks for the quick response!

I don’t think we would need to add one programatically. What we would need to do is identify a repeat control inside a Word template and then iterate over the section(s) contained inside it. Is this approach currently supported?

For example:

Assume a report template has a heading, a table with content controls in the cells, and a paragraph of text (rich text), with a SDT repeat surrounding this. Can aspose.words be used to identify that and then insert the data into those nested content controls?

Are there any limitations on inserting rich text content controls inside of table cells?

  1. Conditionals

We’re using another library which you’re probably familiar with (docx4j). This supports conditionals through XPath 1.0. We can use this to make decisions about what gets output in a given template (include this block if this variable is set; colour this table row red if this value is found; etc.). This is quite powerful for templating purposes. Is there a similar capability in aspose.words? Again, for use with template docs. As far as I understand Word, there is no native support for SDT conditionals. Could a CustomXMLProperty be used for this?

  1. Cross-referencing:

Word has the ability to cross reference within documents using different references, such as the page number, the header (if cross-referencing a header style), numeric cross references, etc. This is something we’ve implemented using another library, effectively creating anchors and bookmarks in the document. It’s limited to PAGENUM and Heading at the moment, but it works. Looking at the API docs, this would appear to be possible with Field (i.e. FieldRef).

Given a summary table with the columns “ID, Title, Page Rerference” build a summary table with the following content:

  1. Numeric ID, which cross-references to the header in the document
  2. Header text, which cross-references to the header in the document
  3. PAGENUM, which cross-references to the header in the document

Sample file attached.

cross-reference-example.docx.zip (11.8 KB)

Understood. I was specifically interested in discussing professional services. Is there a form/email I can use for that?

Cheers,
Dave.

On first impression, LINQ might be closer to what I am looking for?

@drcs,

Thanks for sharing the detail. We are working over your query and will get back to you soon.

@drcs,

Thanks for your patience.

Aspose.Words does support this feature. Field class represents a Microsoft Word document field. FieldPageRef class implements the PAGEREF field and FieldRef class implements the REF field. Please refer to the following article.
Working with Fields

In this case, we suggest you please use LINQ Reporting Engine. Please refer to the following articles:
Template Syntax
Typical Templates

StructuredDocumentTag class represents a structured document tag (SDT or content control) in a document. There is no such limitation on inserting rich text content controls inside table’s cell.

It would be great if you please share your input and expected output document here for our reference. We will then provide you more information on this. If you want to bind StructuredDocumentTag to node of custom XML part, please refer to the following article.
Binding Content Control to Custom XML Parts

Please use Aspose.Words support forum for all your queries.