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

Free Support Forum - aspose.com

WordProcessing.SdtBlock to Aspose.Words.Markup.StructuredDocumentTag conversion possible?

Hi,
I am trying to generate word documents on the server side by using a template (with a bunch of content controls) and html data from a back-end data store. It looks like Aspose doesnt support content controls completely (retrieving content controls by tag etc.,). This can be easily achieved by using openXml SDK but I dont have a nice tool to convert html into openXml. It looks like Aspose does a very good job there…now, can i use the combination of aspose library and openxml?

something like this -

string tag = “MyContentControl”;
SdtBlock cc = mainPart.Document.Body.Descendants().Where
(r => r.SdtProperties.GetFirstChild().Val == tag).Single();

Aspose.Words.Markup.StructuredDocumentTag asposeDocumentTag = GetAsposeSDTFromOpenXmlSDT(cc);

or is there any other way of retrieving Aspose StructuredDocumentTag objects using content control tags?

Hi Sampath,

Thanks for your request. unfortunately, there is no direct way to achieve this. However, if your main purpose is inserting HTML content into SDT controls, I think, you can achieve this by doing the following:

1. Load HTML into Aspose.Words.Document;

2. Save the document as DOCX;

3. Open DOCX document using OpenXml SDK;

4. Extract content from the document using OpenXml SDK;

5. Insert the extracted content into SDT using OpenXml SDK.

Hope this helps.

Best regards,

Thanks for your response Alexey. That is exactly what I ended up doing. Instead of saving the file on the file system, i saved the file in an in-memory stream and opened it using openxml.

Any ETA on when this feature will be included in Aspose?

Thanks,
Sampath

Hi Sampath,

Thanks for your request. We plan to provide access to properties of SDT objects in one of future versions. Most probably this feature will be available in August. But I cannot promise you anything at this stage.

Best regards,

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