Print Page | Close Window

Write Unicode character in the table

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=3653
Printed Date: 26 Apr 24 at 11:58AM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Write Unicode character in the table
Posted By: sjnam07
Subject: Write Unicode character in the table
Date Posted: 25 Dec 18 at 1:51PM
Hello,

I'm trying to write Unicode character in the table like this. (I'm using DLL version of QP)

DPL.SetOrigin(1);
DPL.AddCJKFont(5);//Try to use Korean character
DPL.SetPageSize(L"A4");
DPL.SetMeasurementUnits(1);

DPL.SetTextSize(20);
DPL.DrawTextBox(10, 280, 190, 10, L"안녕하세요", 0); //It works

int id = DPL.CreateTable(6, 5);
DPL.SetTableBorderColor(id, 0, 0, 0, 0);
DPL.SetTableBorderWidth(id, 0, 0.2);
DPL.SetTableRowHeight(id, 1, 6, 10);
DPL.SetTableColumnWidth(id, 1, 5, 35);
DPL.SetTableCellAlignment(id, 1, 1, 6, 5, 4);
DPL.SetTableCellTextSize(id, 1, 1, 6, 5, 5);
DPL.SetTableCellTextColor(id, 1, 1, 6, 5, 0, 0, 0);

DPL.SetTableCellContent(id, 1, 1, L"1a가");
DPL.SetTableCellContent(id, 2, 1, L"2b나");
DPL.SetTableCellContent(id, 3, 1, L"3c다");
DPL.SetTableCellContent(id, 4, 1, L"4d라");
DPL.SetTableCellContent(id, 5, 1, L"5e마");
DPL.SetTableCellContent(id, 6, 1, L"6f바");

DPL.DrawTableRows(id, 10, 30, 100, 1, 6); //It shows only alphabet and number character, not Korean

How can I write Unicode character in the table?

Thank you in advance.



Replies:
Posted By: Ingo
Date Posted: 25 Dec 18 at 6:43PM
Hi sjnam07,

if you look into the online reference you'll see that content is handled as unicode (wchar):
https://www.debenu.com/docs/pdf_library_reference/SetTableCellContent.php
So you don't have to do any special things - strings are handled as unicode.
The only thing you have to put an eye on is to select a font which is able to represent characters in unicode format.

A problem can be your development environment.
If it's an older vb6 for example you have to convert thr strings to unicode first.

Cheers and welcome here,
Ingo



-------------
Cheers,
Ingo



Posted By: sjnam07
Date Posted: 26 Dec 18 at 2:17PM
Hello Ingo,

Thank you for fast reply.

I wonder what DPL.DrawTextBox() with Korean works, but SetTableCellContent() doesn't work. Both are in the same source code file encoded to unicode.
I'm using Visual Studio 2017 with MFC.

Do you have other clues?

Thank you
Sangjae


Posted By: Ingo
Date Posted: 26 Dec 18 at 3:50PM
Like i've written:
Perhaps it's a korean font - not able to show unicode characters?


-------------
Cheers,
Ingo



Posted By: sjnam07
Date Posted: 29 Dec 18 at 8:32AM
Hello,

No, Korean characters, which are unicode, are not shown only in the table. Without table, Korean characters can be shown well.


Posted By: Ingo
Date Posted: 29 Dec 18 at 6:23PM
i've tried the enhanced search function here on the page for you ;-)
Please have a look on the sample (regarding unicode) from AndrewC (R.I.P.):
http://www.quickpdf.org/forum/tables-and-columns_topic2058_post9631.html?KW=unicode+table#9631

Here's a second thread could be worth to have an eye on it:
http://www.quickpdf.org/forum/forum_posts.asp?TID=3133&KW=unicode+table&PID=12541&title=gettablecelldblproperty#12541

Here's a third thread could be worth to have an eye on it:
http://www.quickpdf.org/forum/forum_posts.asp?TID=3581&KW=unicode+table&PID=14271&title=printing-chinese-is-a-random-code#14271



-------------
Cheers,
Ingo



Posted By: sjnam07
Date Posted: 10 Jan 19 at 2:05PM
Hello,

I finally found the solution from one of your link! - http://www.quickpdf.org/forum/tables-and-columns_topic2058_post9631.html?KW=unicode+table#9631

When I write Unicode text in the table, I need to call SetHTMLNormalFont(). Because in the API document, table uses html text.

Thank you very much.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk