Free Support Forum - aspose.cloud

DOCX to HTML conversion with Aspose.Words Cloud API changes TextBox to image instead of HTML input control

Cannot able to parse textbox in a word file to a standard HTML input control.After parsing to html it is displayed as an image.Is it happening due to the trial/evaluation version?

@tchakravarty

Thanks for your inquiry. No, the issue does not relate to evaluation/trial version. I have logged a ticket WORDSCLOUD-962 in our issue tracking system for further investigation and rectification. We will keep you updated about the issue resolution progress within this forum thread.

@tchakravarty

Thanks for your patience. In reference to above reported issue, we have analyzed your requirement and suggest to create Textbox field that can be converted to an html input element using the following code. The code is for a new document but you can use it for an existed document with tiny changes.

var folder = "Tests";
            var fileName = "WordsCloud-962";
            var docxFilename = $"{fileName}.docx";
            var htmlFilename = $"{fileName}.html";
            var destination = @"d:\result.html";

            var api = new WordsApi(appKey, appSid);

            var createFileResult = api.CreateDocument(new CreateDocumentRequest
            {
                FileName = docxFilename,
                Folder = folder
            });

            var addFieldResult = api.InsertFormFieldWithoutNodePath(new InsertFormFieldWithoutNodePathRequest
            {
                Name = docxFilename,
                Folder = folder,
                FormField = new FormFieldTextInput
                {
                    Name = "TextField",
                    Enabled = true,
                    TextInputFormat = "Regular",
                    TextInputDefault = "Type here"
                }
            });

            var converResult = api.SaveAs(new SaveAsRequest
            {
                Name = docxFilename,
                Folder = folder,
                SaveOptionsData = new HtmlFixedSaveOptionsData
                {
                    SaveFormat = "html",
                    FileName = htmlFilename,
                }
            });

            using(var fs = File.Create(destination))
            {
                var htmlFilePath = Path.Combine(folder, htmlFilename);
                using (var stream = api.DownloadFile(new DownloadFileRequest { Path = htmlFilePath }))
                {
                    stream.CopyTo(fs);
                }
            }