Spire.XLS is a professional Excel API that enables developers to create, manage, manipulate, convert and print Excel worksheets. Get free and professional technical support for Spire.XLS for .NET, Java, Android, C++, Python.

Tue Aug 06, 2019 11:48 am

Hello,

I using Spire.XLS 9.7.
Will need to output text containing Variation Selector to Excel and make it PDF.

Using Spire.XLS, exported to Excel with text containing Variation Selector.
'result.xlsx' is displayed without problems on MS Excel.

When this is saved as PDF, the Variation Selector is displayed as garbled characters.
There was no problem when 'result.xlsx' was export to PDF with MS Excel.

Code: Select all
var baseChar = "\U00008FBB";
var baseCharWithVariationSelector = "\U00008FBB\U000E0100";

using (var workbook = new Workbook())
{
    var worksheet = workbook.Worksheets[0];

    var style = workbook.Styles.Add("style");
    style.Font.FontName = "MS 明朝";

    worksheet["A1"].CellStyleName = style.Name;
    worksheet["A2"].CellStyleName = style.Name;

    worksheet["A1"].Text = $"CJK UNIFIED IDEOGRAPH-8FBB : '{baseChar}'";
    worksheet["A2"].Text = $"CID+3056 : '{baseCharWithVariationSelector}'";

    workbook.SaveToFile("result.xlsx", Xls.FileFormat.Version2013);
    worksheet.SaveToPdf("export_by_spire.pdf");
}


Is there way to work around this issue?
Or are there any plans to support IVS?

Thanks in advance.
Attachments
25378_files.zip
result files.
(63.5 KiB) Downloaded 161 times

nf64
 
Posts: 24
Joined: Fri Aug 17, 2018 1:45 am

Wed Aug 07, 2019 10:38 am

Hi,

Thanks for your inquiry. This is Amber from E-iceblue support team.
From you information, I think you want the result like export_by_MSExcel.pdf without any square boxes. And you said while opening result.xlsx, the characters display correctly. Yet I see different result when I open your Excel file with Excel 2013.

box.png
box.png (3.1 KiB) Viewed 1326 times

Could you please tell us what Excel version you used for opening the result Excel file is? And could you provide a screenshot of displaying effect?

I could generate the same result PDF as the file export_by_spire.pdf via Spire. As for garbled characters issue, do you mean there is the square box? And do you want to generate excel and pdf file without these square boxes?

Best wishes,
Amber
E-iceblue support team
User avatar

Amber.Gu
 
Posts: 525
Joined: Tue Jun 04, 2019 3:16 am

Wed Aug 07, 2019 12:36 pm

Hello,

Thank you for your reply.

Yes, Garbled characters are square boxes.
I want the result without this box, that is, the same result as export_by_MSExcel.pdf.

When result.xlsx is opened in MS Excel, it is displayed as follows.
I using Excel 2013 (15.0.5153.1000), and Japanese environment.
View_by_MSExcel2013.png
View in MS Excel 2013
View_by_MSExcel2013.png (3.34 KiB) Viewed 1322 times


When this is exported to PDF, the result is similar to export_by_MSExcel.pdf.
It would be best if you could get similar results using Spire.

This is a screen shot displayed with Acrobat Reader.
Using Acrobat Reader DC 2019.012.20035.
View_in_acrobatReader..png
View in Acrobat Reader
View_in_acrobatReader..png (12.33 KiB) Viewed 1322 times


However, When opening each PDF with Acrobat Reader and checking the Property, I noticed that there is a difference in the embedded font.
The PDF that is displayed correctly seems to have embedded fonts that have ANSI encoding.
pdf_embFonts.png
Embedded fonts
pdf_embFonts.png (11.61 KiB) Viewed 1322 times



Thank you for your support,

nf64
 
Posts: 24
Joined: Fri Aug 17, 2018 1:45 am

Thu Aug 08, 2019 7:44 am

Hi,

Thanks for your information.
I opened the “result.xlsx" with Excel 2013 under win10 system. And the file displays without square boxes.
I have logged your issue into our bug tracking system. Once there is any progress, we will inform you.
Sorry for the inconvenience caused.

Best wishes,
Amber
E-iceblue support team
User avatar

Amber.Gu
 
Posts: 525
Joined: Tue Jun 04, 2019 3:16 am

Wed Aug 14, 2019 10:29 am

Hi,

Hope you are doing well.
To ensure the fix of the issue will work well on your side, please offer us the information of your operation system so that we could verify it after fixing the issue.

Best wishes,
Amber
E-iceblue support team
User avatar

Amber.Gu
 
Posts: 525
Joined: Tue Jun 04, 2019 3:16 am

Fri Aug 16, 2019 12:44 am

Hello,

We used Windows10 64bit Japanease version.
Our product will work in a Japanese environment.
Please let me know if you have any other necessary information.

Thanks.

nf64
 
Posts: 24
Joined: Fri Aug 17, 2018 1:45 am

Fri Aug 16, 2019 9:40 am

Hi,

Thanks for your information.
After further investigation, we found the encoding “U000E0100” will display as a special character when parsing with Unicode.
Note that the display of the encoding is controlled by system. Although the special character of “U000E0100” is not displayed while opening by MS Excel under Win10 System, it really exists in the Excel file(result.xlsx). When converting to Pdf, our Spire.Xls will generate Pdf file according to the actual data of Excel file, thus there will be the character which shows as a square box.
I’m afraid it’s not a bug of our product. Hope you could understand.

Best wishes,
Amber
E-iceblue support team
User avatar

Amber.Gu
 
Posts: 525
Joined: Tue Jun 04, 2019 3:16 am

Wed Aug 21, 2019 2:05 am

Hello,

Yes, it may not be a bug.
I would like to ask if you can use the Variation Selector in Unicode.

'U00008FBB' is the Kanji '辻', but by adding 'U000E0100' immediately after this, it will change to another character.

See the next image.
Note that there is a change in the part surrounded by the red frame.
difference_of_ideograph.png
difference_of_ideograph.png (35.84 KiB) Viewed 1248 times


When using Spire.Xls, only 'U00008FBB' is recognized as a correct character and 'U000E0100' is now a square box.

Excel 2013 correctly recognizes 'U000E0100' and exports to PDF as intended.
I want to do the same when exporting from Spire.Xls to PDF.

At least there are strong needs from Japanese customers.
Are there any plans to support Variation Selector in Unicode?

I am always grateful for your help.

nf64
 
Posts: 24
Joined: Fri Aug 17, 2018 1:45 am

Wed Aug 21, 2019 10:13 am

Hi,

Thanks for your reply.
Since MS Excel will save the data of the document before transferring it to Pdf file, the data of your file may be changed after this saving.
Could you please save the result file(generated by Spire.Xls) as .xlsx file using MS Excel then send it to us?

Best wishes,
Amber
E-iceblue support team
User avatar

Amber.Gu
 
Posts: 525
Joined: Tue Jun 04, 2019 3:16 am

Fri Aug 23, 2019 4:51 am

Hello,

Thanks for your reply.

Attach a new file.
This file is an .xlsx generated by Spire.Xls, opened and saved in MS Excel 2013.
There seems to be no significant difference in content.
Attachments
generateBySpire_savedByExcel.zip
(9.33 KiB) Downloaded 201 times

nf64
 
Posts: 24
Joined: Fri Aug 17, 2018 1:45 am

Fri Aug 23, 2019 9:59 am

Hi,

Thanks for your information.
After further investigation, we found that the data of your original Excel file is actually changed by MS Excel after saving to Pdf. And we found if you change the font setting of the second character to “宋体”, the display effect of the characters in the result Pdf could just be the one you want. I have attached the result files generated by Spire.Pdf, please check it. Below is the code for your reference.
Code: Select all
                var style1 = workbook.Styles.Add("style1");
                style1.Font.FontName = "MS 明朝";

                var style2 = workbook.Styles.Add("style2");
                style2.Font.FontName = "宋体";
               
                worksheet["A1"].CellStyleName = style1.Name;
                worksheet["A2"].CellStyleName = style2.Name;


Note the display of character is controlled by System and is really not the problem of our product, thus we won’t make any change using your original code. Hope you could understand.

Best wishes,
Amber
E-iceblue support team
Attachments
18494.rar
(31.92 KiB) Downloaded 166 times
Last edited by Amber.Gu on Mon Aug 26, 2019 10:35 am, edited 1 time in total.
User avatar

Amber.Gu
 
Posts: 525
Joined: Tue Jun 04, 2019 3:16 am

Mon Aug 26, 2019 5:10 am

Hi,

Thanks for your reply.
My intention does not seem to be communicated correctly.

Your way is changed the font.
Therefore glyph corresponding to the character code has been changed.
As a result it looks like no problem.
18494_result.png
18494_result.png (10.05 KiB) Viewed 1188 times

But that is wrong.
'U000E0100' is changed to a blank, not a square box, resulting in 2 characters being output.
You are need to understand Variation Selector in Unicode, and must output the pair 'U00008FBB' and 'U000E0100' as one character.

But, difficult for me to explain this problem in my poor english.
We are considering giving up this problem.
Unfortunately.

nf64
 
Posts: 24
Joined: Fri Aug 17, 2018 1:45 am

Mon Aug 26, 2019 11:02 am

Hi,

Thanks for your reply.
I have understood your meaning. As I have mentioned, the data of your original Excel file is actually changed by MS Excel after saving to Pdf, thus you could see one character generated by “U00008FBB” and “U000E0100”, but in fact they are two characters when parsing with Unicode.
You could try the following code the see the characters parsed by Unicode on your side.

Code: Select all
string text = Encoding.Unicode.GetString(Encoding.Unicode.GetBytes(baseCharWithVariationSelector));


I am afraid we couldn’t make any change using your original code.
Hope you could understand.

Best wishes,
Amber
E-iceblue support team
User avatar

Amber.Gu
 
Posts: 525
Joined: Tue Jun 04, 2019 3:16 am

Return to Spire.XLS

cron