Please take a look at the file below which was generated at my environment.
sample.pdf (4.8 KB)
@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.
I tried it already and it looks ok because the each line is single line now.
When the text is much longer it should be wrapped and the issue will appear again.
sample2.pdf (4.8 KB)
Please find the sample files:
Text without line breaks
sample_singleLIne.pdf (17.0 KB)
Text with line breaks
sample_withLineBreak.pdf (17.8 KB)
In the second file, “、” comes at first character of a line.
@AT1
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-55715
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-55715) has been resolved and the fixed functionality will be released with version 24.6.
Here is the resulting file generated using the latest function:
CELLSNET-55715.pdf (23.1 KB)
The issues you have found earlier (filed as CELLSNET-55715) have been fixed in this update. This message was posted using Bugs notification tool by johnson.shi
I have just found out that it does not work with some characters, e.g. “」” “ー”. They don’t come at the beginning of the line when creating PDF from Excel.
Also, IsHangingPunctuation = false; does not work at all.
foreach (TextParagraph p in textbox.TextBody.TextParagraphs)
{
p.Font.Name = "MS Gothic";
p.TextOptions.LanguageCode = CountryCode.Japan;
p.IsEastAsianLineBreak = true;
p.IsHangingPunctuation = false;
}
Thank you.
@AT1
We can reproduce the issue by testing it on the latest version v24.6 using the following sample code. Found that TextParagraph.IsHangingPunctuation Attribute does not work when converting files to PDF. Please refer to the attachment. out_net.zip (43.6 KB)
The sample code as follows:
Workbook workbook = new Workbook();
workbook.Settings.Region = CountryCode.Japan;
Worksheet worksheet = workbook.Worksheets.First();
int textboxIndex = worksheet.TextBoxes.Add(1, 1, 60, 235);
TextBox textbox = worksheet.TextBoxes[textboxIndex];
textbox.IsTextWrapped = true;
textbox.Text = "こんにちは、今日はいい天気で」す。\nこんにちは、今日はいい天気でーす。";
foreach (TextParagraph p in textbox.TextBody.TextParagraphs)
{
p.Font.Name = "MS Gothic";
p.TextOptions.LanguageCode = CountryCode.Japan;
p.IsEastAsianLineBreak = true;
p.IsHangingPunctuation = true;
}
workbook.Save(filePath + "out_net2.pdf");
foreach (TextParagraph p in textbox.TextBody.TextParagraphs)
{
p.Font.Name = "MS Gothic";
p.TextOptions.LanguageCode = CountryCode.Japan;
p.IsEastAsianLineBreak = true;
p.IsHangingPunctuation = false;
}
workbook.Save(filePath + "out_net1.pdf");
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-56104
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.
Thank you for your reply.
The text is better as below so that you can see these characters appear on wrong positions.
textbox.Text = “こんにちは、今日はいい天気です」。\nこんにちは、今日はいい天気ですー。”;
There must be some more characters which are not supposed to be at the 1st or the last of each line. Please check the specifications of Excel.
Thank you.
@AT1,
Thank you for your feedback and the suggested text to demonstrate the incorrect characters positions. We have logged it with your existing ticket (“CELLSNET-56104”) in our database. We will evaluate your issue soon. Once we have an update or figure it out, we will let you know here.
@AT1
After carefully studying the way Excel handles punctuation, we optimized the handling of punctuation to make it more suitable for Excel’s processing mode.
The fixed functionality will be released with version 24.7.
The issues you have found earlier (filed as CELLSNET-56104) have been fixed in this update. This message was posted using Bugs notification tool by johnson.shi
Hi,
I have tested version 24.7. I still find some characters in wrong positions.
Would you please list up here all the characters that are handled in version 24.7?
The following is MS Word Asian Typography options. I would like to see the difference compared with them.
Cannot start line
!%),.:;?]}¢°’”‰′″℃、。々〉》」』】〕゛゜ゝゞ・ヽヾ!%),.:;?]}。」、・゙゚¢
Cannot end line
$([{£¥‘“〈《「『【〔$([{「£¥
Thank you.
@AT1,
We apologize that the fixed version does not meet all of your character requirements. We will investigate this matter promptly.
We would also appreciate it if you could provide some example strings that we could try for evaluation to cover all these characters.
Thanks for your reply.
I have just created a text that contains some characters that our clients use quite often. Apparently it does not cover all the characters but this is the best I can do for you now.
Also an outcome of Excel is attached so that you can see the differences.
Test_Excel.pdf (28.2 KB)
Test_Aspose_24.7.pdf.pdf (10.4 KB)
int textboxIndex = worksheet.TextBoxes.Add(0, 1, 800, 235);
Aspose.Cells.Drawing.TextBox textbox = worksheet.TextBoxes[textboxIndex];
textbox.IsTextWrapped = true;
var text = new StringBuilder();
text.AppendLine("こんにちは、今日はいい天気です。");
text.AppendLine();
text.AppendLine("こんにちは、今日はいい天気です、と思う。");
text.AppendLine();
text.AppendLine("こんにちは、今日はいい天気です?");
text.AppendLine();
text.AppendLine("こんにちは、今日はいい天気です!");
text.AppendLine();
text.AppendLine("今日の夕飯は、特別に大きいステーキです。");
text.AppendLine();
text.AppendLine("今日は、皆で「ディズニーランド」に行きます。");
text.AppendLine();
text.AppendLine("今日は、皆で『ディズニーランド』に行きます。");
text.AppendLine();
text.AppendLine("今日は、皆で【ディズニーランド】に行きます。");
text.AppendLine();
text.AppendLine("今日は、皆で(ディズニーランド)に行きます。");
text.AppendLine();
text.AppendLine("今日夕方、会社が終わってから「ディズニーランド」に行きます。");
text.AppendLine();
text.AppendLine("今日夕方、会社が終わってから『ディズニーランド』に行きます。");
text.AppendLine();
text.AppendLine("今日夕方、会社が終わってから【ディズニーランド】に行きます。");
text.AppendLine();
text.AppendLine("今日夕方、会社が終わってから(ディズニーランド)に行きます。");
textbox.Text = text.ToString();
foreach (TextParagraph p in textbox.TextBody.TextParagraphs)
{
p.Font.Name = "MS Gothic";
p.TextOptions.LanguageCode = CountryCode.Japan;
p.IsEastAsianLineBreak = true;
p.IsHangingPunctuation = true;
}
@AT1,
Thanks for the sample files and text strings.
We have tested and found that the issue still persists with certain characters in the text strings you provided. Some characters are being rendered in the wrong positions within the text box during the Excel to PDF conversion.
We will thoroughly evaluate the issue from all aspects. 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-56207
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
Your issue(CELLSNET-56207) has been resolved and the fixed functionality will be released with version 24.8.
The following is the result file generated using the sample code:
CELLSNET-56207.pdf (28.7 KB)