Setting the font and font size of Drawing.TextBox are not working in ODS

Hi Support,
I got a different result for Xlsx converting to Ods when I use the latest version of Aspose.Cells for .NET v19.7.7 For .Net4.0.

I have a template sheet in 01.xlsx (see [01.jpg] 01.jpg (104.6 KB))

Then, I copy the template sheet to another sheet and draw a textbox with code in the sheet.(see [02Xlsx.jpg] 02Xlsx.jpg (130.2 KB))

Below is the code of Drawing TextBox :


Dim objTxt As Aspose.Cells.Drawing.TextBox = Nothing

objTxt = objSheet.TextBoxes(objSheet.TextBoxes.Add(intSRow,
                                                         Convert.ToInt32(Math.Ceiling((intECol - 1) / 2)),
                                                         100,
                                                         100))

      With objTxt
         .HeightPt = objSheet.Cells.Rows(intSRow).Height * 5
         .WidthCM = 5

         .Text = "講  臺"

         .TextHorizontalAlignment = TextAlignmentType.Center
         .TextVerticalAlignment = TextAlignmentType.Center

         With .Font
            .Size = 14
            .Name = "標楷體"
         End With

         .LeftCM = .LeftCM - (.WidthCM / 2)

      End With

When saving as “02.ods,” I got a different result. (see [02Ods.jpg] 02Ods.jpg (128.9 KB) Opening the .ods file by using LibreOffice 6.2.5.2 with Chinese(traditional) language package)

The font “講 臺” of drawing textbox is “標楷體” and the font size of drawing textbox is 14 in “02.xlsx” (see [02Xlsx.jpg]), but the font “講 臺” of drawing textbox is “新細明體” and the font size of drawing textbox is 12 in “02.ods.” (see [02Ods.jpg])

The font and font size of drawing textbox on .Ods file is different from the .Xlsx file.

You can see the different in the picture [03.jpg] 03.jpg (191.1 KB).

You can try the sample code. [ConsoleApp1.zip] ConsoleApp1.zip (4.8 MB)

Please help. Thanks a lot.

@CYHsu,
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-46866 - Setting the font and font size of Drawing.TextBox are not working in ODS

@CYHsu,

Could you share “標楷體” font installer file here? And please confirm you have installed this font in your machine.

@ahsaniqbalsidiqui,

The zip(kaiu.zip) is just the font “標楷體”. kaiu.zip (2.7 MB)

I tried the “Calibri” font. The “標楷體” font of Drawing.TextBox can’t set in ODS, nor can the “Calibri” font.

You can try below code :


      With objTxt
         .HeightPt = objSheet.Cells.Rows(intSRow).Height * 5
         .WidthCM = 5

         .Text = "ABCDE"

         .TextHorizontalAlignment = TextAlignmentType.Center
         .TextVerticalAlignment = TextAlignmentType.Center

         With .Font
            .Size = 16
            .Name = "Calibri"
         End With

         .LeftCM = .LeftCM - (.WidthCM / 2)

      End With

By the way, why need to confirm my end have installed “標楷體” font ? Seeing the [02Xlsx.jpg] given above, and you can confirm my end have installed “標楷體” font.

@CYHsu,
Thanks for feedback.
This is to inform you that we have fixed your issue (logged earlier as “CELLSNET-46866”) now. We will soon provide you the fixed version after performing QA and incorporating other enhancements and fixes.

@CYHsu,

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

Your issue should be fixed in it.

Let us know your feedback.
Aspose.Cells19.8.1 For .Net2_AuthenticodeSigned.Zip (4.9 MB)
Aspose.Cells19.8.1 For .Net4.0.Zip (4.9 MB)

@Amjad_Sahi,

I tried the latest version/fix: Aspose.Cells for .NET v19.8.1 For .Net4.0.
The issues are fixed.
Thanks a lot.

@CYHsu,

Good to know that your issue is sorted out by the new version/fix. Feel free to contact us any time if you need further help or have some other issue or queries, we will be happy to assist you soon.

The issues you have found earlier (filed as CELLSNET-46866) have been fixed in Aspose.Cells for .NET v19.9. This message was posted using BugNotificationTool from Downloads module by Amjad_Sahi