Linespacing

Is there an API for adjusting linespacing within a textbox?


The way you do it in VBA is to use the SpaceWithin property of ParagraphFormat,

Hi,


Well, as you know Aspose.Cells does not support to create, manipulate or embed VBA codes/ macros. I am not sure if you could accomplish the task via normal MS Excel features. Could you give us details on how you could perform the task on a Form control’s TextBox shape using MS Excel features (without using VBAs or macros), you may give us details about steps involved, sample Excel file and screen shots here, we will check it on how to do it via Aspose.Cells APIs.

Thank you.

The Paragraph option on the context menu displays a window. One of the options is called Line Spacing and you can set a value in Lines or Points.


Does Aspose.Cells support this property?

Hi,


Thanks for providing further details.

I think the feature may not be available at the moment. We will check if we could support Lines spacing option for TextBox shape. I have logged a ticket with an id “CELLSNET-43167” for your issue/ requested feature. We will investigate and look into it and may provide you code segment with the APIs to accomplish the task (if possible).

Thank you.

Hi,

I’m having the same problem right now.
The string Im passing to textbox text some has html format and most of time it was rich text string.

But the problem the line spacing is adjusting.
Is their a way to control the line spacing of text in the TextBox?

Appreciate your quick support.

Rolly Hernando
rlhernando@iscksa.com
International Security & Communications Co.

Hi Rolly Hernando,


I am afraid, the feature is still not supported. The feature might be complex as it is taking more time. Anyways, I have logged your concerns and asked the product team to update on it or provide an eta (if possible).

Once we have an update on it, we will let you know here immediately.

Sorry for any inconvenience caused!

Hi,


We have supported the feature in our latest version (e.g Aspose.Cells for .NET v8.8.3, you may download it here). See the following sample code for your reference:
e.g
Sample code:

Workbook workbook = new Workbook();
workbook.Worksheets[0].Shapes.AddTextBox(0, 0, 0, 0, 400, 400);
Shape shape = workbook.Worksheets[0].Shapes[0];
shape.Text = “abc\nefg”;
TextParagraphCollection paragraphs = shape.TextBody.TextParagraphs;
TextParagraph p = paragraphs[1];
p.LineSpaceSizeType = LineSpaceSizeType.Points;
p.LineSpace = 2;
p.SpaceAfterSizeType = LineSpaceSizeType.Points;
p.SpaceAfter = 2;
p.SpaceBeforeSizeType = LineSpaceSizeType.Points;
p.SpaceBefore = 2;
workbook.Save(path + “dest.xlsx”);

Thank you.