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

Free Support Forum - aspose.com

Text formatting bugs when loading/saving .xlsx file with shapes

Hello,

I have a problem where text formatting gets altered when simply loading and saving an .xlsx file that has text inside rectangle shapes. Please see the attached screenshot and example Visual Studio project that demonstrates the problem.

Thank you!

AsposeCellsTextFormattingBug.zip (11.4 KB)

Screenshot_1.png (41.2 KB)

@TryCatchFinally,

Thanks for the sample project with screenshot.

After an initial test, I am able to reproduce the issue as you mentioned via your attached screenshot using your sample code with your template file. I found an issue with text formatting when get/set HTML text of the shape(s). The culprit lines are:

   foreach (var shape in workbook.Worksheets[0].Shapes) 
    { 
        shape.HtmlText = shape.HtmlText; 
    } 

If we omit these lines of code, it works fine and as expected. It looks like Aspose.Cells does not get/set or parse HTML string of the shapes fine.
e.g
Sample code:

   var workbook = new Workbook(@"TestContent\mina.xlsx"); 

    foreach (var shape in workbook.Worksheets[0].Shapes) 
    { 
        shape.HtmlText = shape.HtmlText; 
    } 

    var tmp = Path.GetTempFileName() + ".xlsx"; 
    workbook.Save(tmp); 

    Process.Start(tmp); 

I have logged a ticket with an id “CELLSNET-45694” for your issue. We will look into it soon.

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

Thank you for taking a look at the attachments and confirming the bug.

I forgot to mention that I do indeed need to change the text and retain formatting. The line

shape.HtmlText = shape.HtmlText; 

was to illustrate that the bug arises without modifying the contents of HtmlText.

Thanks again, I look forward to updates,

TCF

@TryCatchFinally,

Thanks for sharing further details.

We will also consider to try to retain formattings when changing the HTML strings of the shape. Please spare us little time. Our concerned developer from product team will evaluate your issue soon.

@TryCatchFinally,

I am afraid, we do not support exporting bullet settings into Shape.HtmlText.
See the following bullet setting:

					<a:pPr marL="285750" indent="-285750">
						<a:buFontTx/>
						<a:buChar char="-"/>
						<a:defRPr/>
					</a:pPr>

We will support exporting bullet text and font later on, but we could not export position correctly to text because the unit of marL and indent is 1/12700 point and not the character.

Thanks again Amjad,

I removed the bullets from the shape but the formatting still gets altered. Please see the below screenshot. Not that the capitalization and underlining in the “before” spreadsheet are inverted in the “after” screenshot.

I understand this will take some time to correct. Do you have a rough estimate of the time table? Weeks or months perhaps?

Thanks again,

TCF

Screenshot_2.png (23.6 KB)

@TryCatchFinally,

Thanks for the screenshot.

I have logged your concerns and findings against your issue “CELLSNET-45694” into our database. I have also asked product team to provide an ETA (if possible). Our concerned developer from product team will evaluate it soon.

Once we have any new information, we will let you know here.

@TryCatchFinally,

Please try our latest version/fix: Aspose.Cells for .NET v17.9.5.

Your issue should be fixed in it.

Let us know your feedback.

Thank you Amjad,

The formatting looks improved, but there still appears to be missing bullets. Please see attached image. I saw your note above about bullets not being supported. Does that mean that it’s just currently broken, or there or no plans for this library to support bullets going forward?

@TryCatchFinally,

Yes, bullets and relevant font would be missing/broken. Also, currently there is no plan to support it in near future, Once we have an update on it, we will let you know here.