TEXT ALIGN of TextBox in Excell

Hello Technical support team



We have been using Aspose.Cells for .NET.



I want to add one textbox in excel, using htmlText property. But TextAlignment always a direction.



Attached project: HtmlTextOfTextBox.rar



Thanks.



Hoang Van Tuan

Hi Hoang,

Thanks for your posting and using Aspose.Cells.

We were able to observe this issue after executing the following code using the latest version: Aspose.Cells
for .NET v8.2.0.3
. Text alignment of the textbox is always left after setting it with the HTML.

We have logged this issue in our database for investigation. We will look into it and fix this issue. Once, the issue is resolved or we have some other update for you, we will let you know asap.

This issue has been logged as CELLSNET-42971.

I have also attached the output xls file for a reference.

C#


var _zHtml = @“<Font Style="“FONT-WEIGHT: bold;FONT-FAMILY: Arial;FONT-SIZE: 11pt;COLOR: #000000;TEXT-ALIGN: right;"”>Hello

<Font Style="“FONT-FAMILY: Arial;FONT-SIZE: 11pt;COLOR: #ff0000;TEXT-ALIGN: center;"”>Hello

<Font Style="“FONT-FAMILY: Arial;FONT-SIZE: 11pt;COLOR: #000000;TEXT-ALIGN: left;"”>Hello”;


var _book = new Aspose.Cells.Workbook();

var _sheet = _book.Worksheets[0];

var _textBox = _sheet.Shapes.AddTextBox(1, 0, 1, 0, 200, 200);


_textBox.HtmlText = _zHtml;

_book.Save(“Test.xls”);



Hi Hoang,

Thanks for using Aspose.Cells.

We have evaluated this issue further. We are afraid, you cannot apply text alignment to partial text. You can only apply it to full text.

In order to apply alignment to full text, please use the following code.

_textBox.TextHorizontalAlignment = TextAlignmentType.Center;

C#


var _zHtml = @"<Font Style="“FONT-WEIGHT:bold;FONT-FAMILY:Arial;FONT-SIZE:12pt;COLOR:#000000;text-align:center;”">Hello

<Font Style="“FONT-FAMILY:Arial;FONT-SIZE:14pt;COLOR:#ff0000;text-align:right;”">Hello

<Font Style="“FONT-FAMILY:Arial;FONT-SIZE:16pt;COLOR: #0ff000;text-align:left;”">Hello";


var _book = new Aspose.Cells.Workbook();

var _sheet = _book.Worksheets[0];

Aspose.Cells.Drawing.TextBox _textBox = _sheet.Shapes.AddTextBox(1, 0, 1, 0, 200, 200);


_textBox.HtmlText = _zHtml;

_textBox.TextHorizontalAlignment = TextAlignmentType.Center;


_book.Save(“Output.xlsx”);

Hi Shakeel Faiz,

I tried again. But all text alignment are center.

I
want to
Aspose.Cell TextBox displays:



But Aspose.Cell TextBox displays:



Thanks

hvtuan

Hi Hoang,

Thanks for your posting and using Aspose.Cells.

Currently, you cannot apply different text alignment to partial text inside the TextBox. You can only apply the alignment to whole of the text inside the TextBox. So we are afraid this feature is not available as yet.

However, we have logged a New Feature request in our database to support it in our future versions. We will look into it and see if it is possible to implement it. Once, this feature is available or we have some other update for you, we will let you know asap.

This issue has been logged as

  • CELLSNET-42992 - Applying text alignment to partial text inside the TextBox

Hi Shakeel Faiz,


Issue CELLSNET-42992 - Applying text alignment to partial text inside the TextBox


We have a production Aspose.Cells license. We want to know when new updates are available.

Thanks,

hvtuan

Hi,


Well, I have checked the status of your issue “CELLSNET-42992”, it is pending for analysis. Once the relevant developer will evaluate and analyze the issue, we will be in better position to update you on it or provide an eta for it.

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

Thank you.

The issues you have found earlier (filed as CELLSNET-42992) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by Amjad_Sahi