@AT1
Please refer to TextParagraph.IsEastAsianLineBreak property. If you have any further questions, please send us the runnable code for further analysis. Thank you!
Thank you very much for your reply.
I tried the code below but no success yet. In the print preview ‘。’ still comes at the beginning of the 2nd line.
Please find attached for the details.
Aspose Textbox.pdf (24.8 KB)
I’m using Aspose.Cells v22.30, if this works well in another version please kindly let me know.
using Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets.First();
int textboxIndex = worksheet.TextBoxes.Add(1, 1, 60, 235);
TextBox textbox = worksheet.TextBoxes[textboxIndex];
textbox.IsTextWrapped = true;
textbox.Text = "こんにちは、今日はいい天気です。";
foreach(TextParagraph p in textbox.TextBody.TextParagraphs)
{
p.Font.Name = "MS Gothic";
p.IsEastAsianLineBreak = true;
}
MemoryStream stream = new MemoryStream();
workbook.Save(stream, SaveFormat.Xlsx);
stream.Seek(0, SeekOrigin.Begin);
string filename = "test.xlsx";
return File(stream, MimeKit.MimeTypes.GetMimeType(filename), filename);
@AT1
Please set language for the text as the following:
foreach (TextParagraph p in textbox.TextBody.TextParagraphs)
{
p.Font.Name = "MS Gothic";
p.TextOptions.LanguageCode = CountryCode.Japan;
p.IsEastAsianLineBreak = true;
}
Great, that worked! Now I save the excel file in pdf as below, then ‘。’ comes at the beginning of the lien again.
Aspose Textbox 2 (2).pdf (23.0 KB)
MemoryStream stream = new MemoryStream();
workbook.Save(stream, SaveFormat.Pdf);
stream.SeekToZero();
string fname = "test.pdf";
return File(stream, MimeKit.MimeTypes.GetMimeType(fname), fname);
@AT1,
It is nice to know that it works when rendering to XLSX. Regarding rendering to PDF, we found the issue as you mentioned and will be looking into it soon.
@AT1,
As we reproduced Asian line break issue for shapes when rendering Excel file to PDF you pointed above, so, we have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): CELLSNET-55511
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.
@AT1
Hi,
Your issue(CELLSNET-55511) has been resolved and the fixed functionality will be released with version 24.5.
Here is the resulting file generated using the latest function:
CELLSNET-55511.pdf (23.0 KB)
The issues you have found earlier (filed as CELLSNET-55511) have been fixed in this update. This message was posted using Bugs notification tool by johnson.shi
This issue still persists with v24.5 when the text has multiple lines. Can you please advice me how to resolve this?
@AT1,
I tested your scenario/case using the following sample code with Aspose.Cells for .NET v24.5 and it works fine. Both Excel and PDF files (attached) are Ok.
e.g.,
Sample code:
using Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets.First();
int textboxIndex = worksheet.TextBoxes.Add(1, 1, 60, 235);
TextBox textbox = worksheet.TextBoxes[textboxIndex];
textbox.IsTextWrapped = true;
textbox.Text = "こんにちは、今日はいい天気です。";
foreach(TextParagraph p in textbox.TextBody.TextParagraphs)
{
p.Font.Name = "MS Gothic";
p.TextOptions.LanguageCode = CountryCode.Japan;
p.IsEastAsianLineBreak = true;
}
workbook.Save("e:\\test2\\out1_new1.xlsx", SaveFormat.Xlsx);
workbook.Save("e:\\test2\\out1_new1.pdf");
files1.zip (11.0 KB)
Could you please share your sample (runnable) code and output files for reference. We will check your issue soon.
Thanks for your replay.
Please set the text blow and test again for me?
textbox.Text = “こんにちは、今日はいい天気です。\nこんにちは、今日はいい天気です。”;
@AT1,
Thanks for providing further details.
I used your new text. It is not an issue with the APIs as the text is wrapped and lines breaks are added OK. Please note, to display the whole text (if the text is long) properly, you need to extend the width/height of the text box a bit accordingly. Alternatively, you should create the text box with proper height and width. See the line of code that you may add to the code segment and it will work fine.
.......
textbox.Width= textbox.Width +20;
workbook.Save("e:\\test2\\out1_new1.xlsx", SaveFormat.Xlsx);
workbook.Save("e:\\test2\\out1_new1.pdf");
Hope, this helps a bit.
@AT1,
Please try the line in your enviroment.
textbox.Width= textbox.Width + 40;
Let us know if you still find the issue.
Of course if you change the width of the textbox the issue will be solved. But the actually issues is that in Japanese language “。” should not be the first character when the text is wrapped.