Read Word Form Controls

I have a word form (.doc) with controls like checkbox, radio and text (ex. OMR sheet). Is there a product of Aspose that will read the document and list out the controls along with their details?

Hi Sricharan,

Thanks for your inquiry. Could you please attach your input Word document here for our reference? We will then provide you more information about your query along with code.

Hi Tahir,

I could not find an option to generate OMR form using Microsoft Word Interpol. So I pasted the OMR sheet image in word. Do you have a component that would generate OMR bubbles (alike sheet pasted in attachment) with inputs like no of questions and no of options per question? So that I can Generate OMR bubble document, convert to Pdf. Also tell if there is a functionality that reads Pdf (converted from above mentioned word using Aspose.Word) to give dimensions top, left, width, height of each content control after conversion?

Regards,

Sricharan Kalavagunta

Software Developer,

Arcadix Infotech Private Limited

Hi Tahir,

Thanks a lot for the reply. The code you had provided helped me to understand Aspose better. Can I get the content controls that are there in the attached Word document using Aspose? I tried code snippet you mentioned to read but did not find controls. Is it possible for Aspose to read controls that were created by using developer tab in Microsoft Word? I just want to use Aspose to read content controls. Thanking you

Regards,

Sricharan Kalavagunta

Software Developer,

Arcadix Infotech Private Limited

Hi Sricharan,

Thanks
for your inquiry. You can interact with content controls by using StructuredDocumentTag class.
Structured document tags (SDTs) allow to embed customer-defined
semantics as well as its behavior and appearance into a document. You can get the collection of contents control by using Document.GetChildNodes method. See the following code snippet.

Document doc = new Document(MyDir + "in.docx");
foreach (StructuredDocumentTag std in doc.GetChildNodes(NodeType.StructuredDocumentTag, true))
{
// Your code...
}

FormField
class represents a single form field. Microsoft Word provides the
following form fields: checkbox, text input and dropdown (combobox).

You can add/modify contents of content controls (StructuredDocumentTag) by using Aspose.Words. Here is the code to insert plain text and select the Drop Down List item from the content control:

Document doc = new Document(@"c:\test\SDTs.docx");
foreach (StructuredDocumentTag sdt in doc.GetChildNodes(NodeType.StructuredDocumentTag, true))
{
    if (sdt.SdtType == SdtType.PlainText)
    {
        sdt.RemoveAllChildren();
        Paragraph para = sdt.AppendChild(new Paragraph(doc)) as Paragraph;
        Run run = new Run(doc, "new text goes here");
        para.AppendChild(run);
    }
    else if (sdt.SdtType == SdtType.DropDownList)
    {
        SdtListItem secondItem = sdt.ListItems[2];
        sdt.ListItems.SelectedValue = secondItem;
    }
}
doc.Save(@"c:\test\out.docx");

Regarding ActiveX controls, there is no way to insert ActiveX controls into MS Word documents using Aspose.Words. However, we had already logged this feature request as WORDSNET-1877 in our issue tracking system. You will be notified via this forum thread once this feature is available. We apologize for your inconvenience.

Thanks Thahir

This is exactly what I am looking out for and happy to know that Aspose provides it.

Is there a method that would get the complete html (along with positions of content controls and styles) from pdf? If not, could I get it from doc? apart from accessing content controls one by one from pdf. What are the limitations of getting perfect html then? I have attached an aspose word and pdf for reference.

Hi Sricharan,

Thanks
for your inquiry. Unfortunately, I have not understood your query. There is no html in your shared Docx and Pdf documents. Could you please share some more detail about your query? We will then provide you more information about your query along with code.

I have attached ‘Aspose Word.docx’ created in MS Word with developer tab using content control checkbox along with properties. Can I get the html of checkbox controls in the document using Aspose.Word? Is there a method in Aspose.Word that could export html from word pages? I need the positions of the content control checkboxes on word page.

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

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