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

Free Support Forum - aspose.com

Shape text style (104)

Hi,


I need to change the text in the Shape and keep its style but when I run the code below style always changes. Is there a way to keep the style of the text?


Thanks,
Zeljko


Code:
String path = “Test.xlsx”;

Workbook workbook = new Workbook(path);
Worksheet worksheet = workbook.getWorksheets().get(0);

Shape shape = worksheet.getShapes().get(0);

shape.setText(“NEW TEXT”);

workbook.save("/home/emisia/Desktop/TestXX.xlsx");

Hi,

Thanks for your posting and using Aspose.Cells.

We have tested this issue with the latest version:
Aspose.Cells for Java v8.8.2.6
using your source excel file and sample code and found that the latest version throws exception.

However, we were able to achieve your output using the following sample code. You may try it at your end and use it as a workaround.

I have also attached the output excel file generated with this code for your reference

C#

Workbook workbook = new Workbook(dirPath + “Test.xlsx”);

Worksheet worksheet = workbook.getWorksheets().get(0);

Shape shape = worksheet.getShapes().get(0);

//shape.setText(“NEW TEXT”);

String strText = shape.getText();

shape.setText(shape.getText().replace(strText, “Zeljko is online”));

workbook.save(dirPath + “output.xlsx”);

Hi,

Thanks for using Aspose.Cells.

We have also fixed your main issue which was logged in our database as CELLSNET-44522. We will soon port the fix in Java version too and provide it to you after performing QA and including other enhancements and fixes.

Hi,


Thanks for the example but unfortunately I still get the same exception, please see the screenshot and the output file.


Thanks,
Zeljko

Hi,


Thanks for the sample file and screenshot.

As Shakeel Faiz told you that we have fixed your issue. Please wait for the next fix here, hopefully your issue would be completely fixed.

Keep in touch.

Thank you.

Hi,

Thanks for your using Aspose.Cells.

Please download and try the latest fix: Aspose.Cells for Java v8.8.2.7 and let us know your feedback.

The issues you have found earlier (filed as CELLSNET-44522) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.

Hi,


I switched to Aspose.Cells for Java 16.11.0 and this issue still occurs.

Can you check it again?

Thanks,
Zeljko

Hi Zeljko,


Thank you for writing back. I have reevaluated the presented scenario while using the latest version of Aspose.Cells for Java 16.11.6, and I am not able to observe the said issue, that is; text in the shape has been changed without affecting the style. Could you please give a try to the latest version (attached) and share your feedback? In case the problem persists, please provide us your environment details as follow.

  • Operating system version & architecture
  • JDK vendor, version & architecture
  • JVM arguments, if any
  • Locale of your machine
  • Input spreadsheet, if different than what you have already shared in this thread.

Hi Babar,


I switched to Aspose.Cells for Java 16.11.6 and the issue still persists. Even if I open the file you attached in the previous post - TestXX.xlsx, I can see the difference in MS Excel. It looks like gradient outline width is not the same.

Please find attached source file, target file and screenshot with the highlighted difference.

Here are the environment details:

Operating system version & architecture:
Ubuntu 14.04 LTS x64
JDK vendor, version & architecture:
java version "1.8.0_101"
Java™ SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot™ 64-Bit Server VM (build 25.101-b13, mixed mode)
JVM arguments, if any:
No VM arguments
Locale of your machine:
English US

Thanks,
Zeljko

Hi,


Thanks for your posting and using Aspose.Cells.

We have tested your issue with the following sample code using the latest version: Aspose.Cells for Java v16.11.6 and observe the issue as per your screenshot.

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

  • CELLSJAVA-42085 - Setting the shape text changes the text style

I have also attached the output excel file generated by the following code and your source excel file and the screenshot for a reference.

Java
Workbook workbook = new Workbook(dirPath + “Test.xlsx”);

Worksheet worksheet = workbook.getWorksheets().get(0);

Shape shape = worksheet.getShapes().get(0);

//Setting the shape text changes text style as shown in screenshot
shape.setText(“NEW TEXT”);

workbook.save(dirPath + “output.xlsx”);

Hi,


This is to update you that your ticket logged earlier as “CELLSJAVA-42085” has been resolved. We will soon share the fix here for your testing after performing QA and incorporating other enhancements and fixes.

Thank you.
Hi,

Thanks for using Aspose.Cells.

Please download and try the latest fix: Aspose.Cells for Java v16.11.10 and let us know your feedback.

Hi Shakeel,


Thanks for the fix. It’s fine now.

Regards,
Zeljko
Hi,

Thanks for your feedback and using Aspose.Cells.

It is good to know that your issue is resolved with the latest fix. Let us know if you encounter any other issue, we will be glad to look into it and help you further.

The issues you have found earlier (filed as CELLSJAVA-42085) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.