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

Free Support Forum - aspose.com

TextBox.getText() problem

Hi,


while I was handling some “.xlsx” documents using Your API I’ve get on a problem. What I was trying is to get text from TextBox, and I’ve got text, but with, how it seems, duplicated new lines. That is not good, so I am asking You for help. For this job I’ve been using the code given below:
String path = “/home/textBoxNewLine.xlsx”;
Workbook workbook = new Workbook(path);
WorksheetCollection wc = workbook.getWorksheets();
Worksheet sheet = wc.get(0);
TextBoxCollection tbc = sheet.getTextBoxes();
TextBox tb = tbc.get(0);
String text = tb.getText();
System.out.println(text);

The excel file I used is also attached to the post.
I hope You’ve got a solution for this, thanks!

Hi,

Thanks for your posting and using Aspose.Cells for Java.

Please download and try the latest version: Aspose.Cells
for Java v7.5.0.1
. It works fine. We have tested your code with the latest version and it gave the following output which is exactly the same output as MS-Excel shows inside the textbox.

Output:
frist line with one line break
second with two

third…


fourth

Hi,


Well, it is not an issue with the product. If you could open the file into MS Excel and then click on the text box and select all the text in it, click Copy by right clicking on it, now paste it into notepad, you will get the following data pasted into it:

frist line with one line break

second with two


third…



fourth


When I run your code with your template file, I got the following output in the command prompt/console:


frist line with one line break
second with two

third…


fourth

So, there is no difference that I could spot, it works as expected. I am using the latest version of Aspose. Cells for Java v7.5.0.

Thank you.