Checkboxes not fully displaying in Aspose 16.8 and 17.9

We are trying to render a document that has checkboxes with some fairly long text to the right of them. As you can see from the image in the zip file, the checkboxes are being truncated on the right side. In testing I discovered that if I don’t add the text following the checkbox, the checkbox does fully render. So, what it appears to be is that even though we are (attempting) to set the width of the cell where the text is place to allow room for the checkbox, it seems to ignore the specified width. In otherwords, no matter what size we specify the cell following the checkbox to be, the checkbox is always cut off in exactly the same place, as if there the cell width for the checkbox is always defaulting to a size that won’t allow it to show fully. In the zipfile is an image showing the problem, the source Word document, and the method that is doing the insertion of the checkbox and text into the Word document. The issue occurs on both versions 16.8 and 17.9.

I have a zipfile with an image showing the issue, a document with the code creating the checkboxes, and the source Word document if you need it. I think we may also have premium support, and I am trying to confirm that. If we do, I’ll create a paid support issue.

@srjbireley,

Thanks for your inquiry. Please ZIP and attach the following resources here for testing:

  • Your input Word documents
  • Aspose.Words 18.3 generated output document showing the undesired behavior
  • Please create a standalone console application (source code without compilation errors) that helps us reproduce your problem on our end and attach it here for testing.

As soon as you get these pieces of information ready, we will start investigation into your issue and provide you more information. Thanks for your cooperation.

AsposeCheckboxRenderingIssue.zip (203.9 KB)
I’ve attached a zip file of the source Word document, an image of what the output looks like, and the method used to add the checkboxes. These were done with Aspose 17.9, but 16.8 displays the same way.

We are in the process of purchasing elevated support. Will I need to resubmit everything on the paid support forum, or will you be able to verify our status, and upgrade this request?

@srjbireley,

Thanks for your inquiry. After an initial test with the latest version of Aspose.Words for .NET i.e. 18.4, we were unable to reproduce this issue on our end. Please see attached output documents (18.4-outputs.zip (211.3 KB)) that were produced by using the following simple code:

Document doc = new Document(MyDir + @"AsposeCheckboxRenderingIssue\DISCLOSURE AND CONSENT SEDATION, ANESTHESIA and_or PERIOPERATIVE PAIN MANAGEMENT (ANALGESIA) .docx");
DocumentBuilder _documentBuilder = new DocumentBuilder(doc);

_documentBuilder.MoveToDocumentEnd();

Section currentSection = _documentBuilder.CurrentSection;
PageSetup pageSetup = currentSection.PageSetup;

// TODO: should the width of the checkbox cell be font size-dependent? 
// In other words, should we be trying to measure the width of a checkbox?
double checkboxCellWidth = 25d;    // points

// For an example of building tables with DocumentBuilder, see
// http://www.aspose.com/documentation/file-format-components/aspose.words-for-.net-and-java/create-headersfooters-using-documentbuilder.html
Table table = _documentBuilder.StartTable();

for (int index = 0; index < 10; index++)
{
    _documentBuilder.InsertCell();
    table.AutoFit(AutoFitBehavior.AutoFitToContents);

    // Make sure the table grid lines are invisible
    _documentBuilder.CellFormat.Borders.LineStyle = LineStyle.None;

    string listOptionValue = "fieldData.ListOptionValue(index, mergeField.LocaleId fieldData.ListOptionValue(index, mergeField.LocaleId fieldData.ListOptionValue(index, mergeField.LocaleId fieldData.ListOptionValue(index, mergeField.LocaleId > " + index;
    bool isChecked = true;

    // VSTS 5372 - there are problems rendering form-type checkboxes to PDF.
    // See, for example:
    // https://forum.aspose.com/t/115217
    // https://forum.aspose.com/t/92355
    // The alternative is not to use a real checkbox but instead render a checked or unchecked box using 
    // the Wingdings font.

    // Use one or the other of the following two lines:
    _documentBuilder.InsertCheckBox(string.Empty, isChecked, 0);
    //WriteCheckboxUsingWingdingsFont(isChecked);

    var listOptionCell = _documentBuilder.InsertCell();
    listOptionCell.CellFormat.Width = table.PreferredWidth.Value - checkboxCellWidth;

    _documentBuilder.Write(listOptionValue);
    _documentBuilder.CurrentParagraph.ParagraphFormat.Alignment = ParagraphAlignment.Left;

    _documentBuilder.EndRow();
}
_documentBuilder.EndTable();

doc.Save(MyDir + @"AsposeCheckboxRenderingIssue\18.4.docx");
doc.Save(MyDir + @"AsposeCheckboxRenderingIssue\18.4.pdf");

Is that version (18.4) available yet? When I go to the website, the latest I can download is 18.1. We do have the maintenance - would that allow us to get the new version?

Thanks for your help!

@srjbireley,

Yes, we have just released 18.4 version of Aspose.Words for.NET. Please refer to the following article:
Installing Aspose.Words for .NET through NuGet

I’ve tested 18.4 in our environment, and it does appear to correct both issues we had reported.

We do have an existing maintenance agreement in place - can you tell me what I need to do to get the updated license file? (I have also asked our purchasing department for the same thing - I just thought I’d ask you as well in case they come to me with questions.)

Thanks!

@srjbireley,

Please open your license (.lic) file with Notepad (but do not edit or re-save it) and check the subscription expiry date. If the license expiry date is greater than 02 April, 2018 (release date of 18.4 version) then you can freely upgrade to 18.4 version of Aspose.Words for .NET.

In case you have further inquiries, please contact our sales department.