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

DOCX in china #57

Closed
CPonty opened this issue Aug 31, 2016 · 8 comments
Closed

DOCX in china #57

CPonty opened this issue Aug 31, 2016 · 8 comments

Comments

@CPonty
Copy link
Contributor

CPonty commented Aug 31, 2016

Looks like there is no support for the Chinese character set:

public Paragraph Font(FontFamily fontFamily)
        {
            ApplyTextFormattingProperty
            (
                XName.Get("rFonts", DocX.w.NamespaceName),
                string.Empty,
                new[] 
                {
                    new XAttribute(XName.Get("ascii", DocX.w.NamespaceName), fontFamily.Name),
                    new XAttribute(XName.Get("hAnsi", DocX.w.NamespaceName), fontFamily.Name), // Added by Maurits Elbers to support non-standard characters. See http://docx.codeplex.com/Thread/View.aspx?ThreadId=70097&ANCHOR#Post453865
                    new XAttribute(XName.Get("cs", DocX.w.NamespaceName), fontFamily.Name),    // Added by Maurits Elbers to support non-standard characters. See http://docx.codeplex.com/Thread/View.aspx?ThreadId=70097&ANCHOR#Post453865
                }
            );

            return this;
        }

Adding support should be as simple as:

new XAttribute(XName.Get("eastAsia", DocX.w.NamespaceName), fontFamily.Name)
@ichpuchtli
Copy link

DocX is yuuge in china.

@PrzemyslawKlys
Copy link
Contributor

@CPonty feel free to submit pull request :-)

@PrzemyslawKlys
Copy link
Contributor

If possible please create a test case as well with chinese document or so.

@neights
Copy link

neights commented Sep 2, 2016

@ichpuchtli ah........ what is yuuge??? yuuge.......
DocX is very popular in China
I used it in a lot of projects to generate docx files
so cool......

@neights
Copy link

neights commented Sep 2, 2016

@CPonty i'm ice ,Thanks for your reply
this is my new GitHub Account
After study together

@ichpuchtli
Copy link

@neights don't worry yuuge is an joke with my colleague @CPonty. I'm sure DocX is huge in china. I think @CPonty should make a pull request.

@wuchao288
Copy link

wuchao288 commented Sep 16, 2016

根据 CPonty 的指导, DocX设置中文字体无效的修正方法,可以把作者的项目下载修改后再编译,期待作者nuget上更新.
I changed the code like this

    public Paragraph Font(FontFamily fontFamily)
        {
            ApplyTextFormattingProperty
            (
                XName.Get("rFonts", DocX.w.NamespaceName),
                string.Empty,
                new[] 
                {
                    new XAttribute(XName.Get("eastAsia", DocX.w.NamespaceName), fontFamily.Name),
                    new XAttribute(XName.Get("ascii", DocX.w.NamespaceName), fontFamily.Name),
                    new XAttribute(XName.Get("hAnsi", DocX.w.NamespaceName), fontFamily.Name), 
                    new XAttribute(XName.Get("cs", DocX.w.NamespaceName), fontFamily.Name)
                }
            );
            return this;
        }
        //Paragraph p2 = document.InsertParagraph("参考行程", false);
        //p2.FontSize(20).Font(new FontFamily("黑体"));

@CPonty thank you!

PrzemyslawKlys added a commit that referenced this issue Sep 16, 2016
Added unit test Test_Table_SetTableDesignNone() draft. Requires fix in Tables.
@PrzemyslawKlys
Copy link
Contributor

I am not sure why you guys couldn't commit this change as normal change. Added and closin this topic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants