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

Free Support Forum - aspose.com

Aspose.Cells .NET 17.4.0: Setting TextParagraph properties results in multiple overlapping lines of text

To reproduce this bug, download and unzip the attached .zip TextBoxOverlapExample.zip (7.1 KB)
and load the workbook within into a new Workbook object. Run the following code:

using (var workbook = new Workbook("TextBoxOverlapExample.xlsx)) {
var sheet = workbook.Worksheets[0];
var textBox = sheet.TextBoxes[0];
var textParagraphs = textBox.TextBody.GetTextParagraphs().ToArray();

                foreach (var tp in textParagraphs) {
                    tp.LineSpaceSizeType = tp.LineSpaceSizeType;
                    tp.AlignmentType = tp.AlignmentType;
                    tp.FontAlignType = tp.FontAlignType;
                    tp.LineSpace = tp.LineSpace;
                    tp.LeftMargin = tp.LeftMargin;
                    tp.RightMargin = tp.RightMargin;
                    tp.FirstLineIndent = tp.FirstLineIndent;
                }

                workbook.Save(@"C:\temp\TextBoxOverlapExample.xlsx");
            }

Observe that in the saved workbook the two lines of text are rendered on top of one another. What causes this, and how can this be avoided when setting TextParagraph properties? Thank you.

@Justafool,
We were able to observe the issue but we need to look into it more. We have logged the issue in our database for investigation and for a fix. Once, we will have some news for you, we will update you in this topic.

This issue has been logged as

CELLSNET-47332 – Setting TextParagraph properties results in multiple overlapping lines of text

@Justafool,
If TextParagraph.LineSpaceSizeType is set, TextParagraph.LineSpace should be set together, otherwise the line space is zero, so the text is overlapped.
We will init TextParagraph.LineSpace later in the next fix when TextParagraph.LineSpaceSizeType is set. For now you can set it by yourself, see following codes:

tp.LineSpaceSizeType = tp.LineSpaceSizeType;
tp.LineSpace = 10.8;

Thank you for the response, but debugging reveals that both text paragraphs in the textbox already had their LineSpace equal to zero before any setters were called. Both the LineSpaceSizeType and the LineSpace are being set in the loop, so I do not see how your proposed solution of setting both together prevents the overlap from happening. Is the LineSpace property ignored in rendering unless the LineSpaceSizeType setter is called?

@Justafool,
Thank you for the feedback. We have recorded it for our reference.

Thank you. Can you please let me know if you make any further progress investigating this?

@Justafool,
This issue is logged too recently and still in queue for analysis as few other tasks are already in progress. We will write back here as soon as some feedback is ready to share.

@Justafool,

Please try our latest version/fix: Aspose.Cells for .NET v20.4.5 (attached)

Your issue should be fixed in it.

Let us know your feedback.
Aspose.Cells20.4.5 For .Net2_AuthenticodeSigned.Zip (5.3 MB)
Aspose.Cells20.4.5 For .Net4.0.Zip (5.4 MB)

The issues you have found earlier (filed as CELLSNET-47332) have been fixed in Aspose.Cells for .NET v20.5. This message was posted using Bugs notification tool by Amjad_Sahi