Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

请问如何输入 tab 控制符 #17

Open
jdhanyang opened this issue Mar 1, 2024 · 3 comments
Open

请问如何输入 tab 控制符 #17

jdhanyang opened this issue Mar 1, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@jdhanyang
Copy link

输入 tab 是用来对齐用的,代码如下:

auto p = doc.AppendParagraph("甲 方:\t\t\t\t乙 方:", 12, "Times New Roman", "宋体");

以上的 \t 并不起作用,生成的文件中被替换成了空格,请教应如何输入 tab 控制符

@GermanAizek
Copy link
Contributor

GermanAizek commented Mar 1, 2024

输入 tab 是用来对齐用的,代码如下:

auto p = doc.AppendParagraph("甲 方:\t\t\t\t乙 方:", 12, "Times New Roman", "宋体");

以上的 \t 并不起作用,生成的文件中被替换成了空格,请教应如何输入 tab 控制符

@jdhanyang, have you tried to do this? Its only and higher C++11 feature.

auto p = doc.AppendParagraph(R"(甲 方:\t\t\t\t乙 方:)", 12, "Times New Roman", "宋体");

@jdhanyang
Copy link
Author

jdhanyang commented Mar 1, 2024

@GermanAizek
Thanks, but it doesn't work.

auto p = doc.AppendParagraph(R"(甲 方:\t\t\t\t乙 方:)", 12, "Times New Roman", "宋体");

result is:
甲 方:\t\t\t\t乙 方:

Microsoft Visual Studio Community 2022 (64 位) , ISO C++14 标准 (/std:c++14)

@totravel
Copy link
Owner

totravel commented Mar 2, 2024

try this:

auto r = doc.AppendParagraph().AppendRun();
r.AppendText(u8"甲方:");
r.AppendTabs(4);
r.AppendText(u8"乙方:");

@totravel totravel added the enhancement New feature or request label Mar 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants