简体   繁体   English

打开XML格式的SDK 2.0换行符

[英]Open Xml Format sdk 2.0 Line Breaks

I have written a function which collects from a two dimensional array. 我写了一个从二维数组收集的函数。 The issue I am having it that I used a string builder to put them both into one string but I would like a break in between 我遇到的问题是,我使用了一个字符串生成器将它们都放入一个字符串中,但是我想

public static string[,] ArrSkills = new string[,] 
{
    { "Live The Dream More" }, 
    { "And Even More" } 
};

public static void WriteSkills()
{
    StringBuilder Builder = new StringBuilder();
    foreach (string s in ArrSkills)
    {
        Builder.AppendLine(s);
    }
    GetSkills = Builder.ToString(); ;
}

The output at the moment is "Live The Dream MoreAnd Even More" when using AppendLine the output has two unknown character symbols where the line break should be. 当使用AppendLine时,当前输出为“ Live The Dream MoreAnd More More”,输出有两个未知的字符符号,应在其中放置换行符。 I am writing to a custom XML linked to content controls. 我正在写链接到内容控件的自定义XML。 I was just wondering how would I be able to spit the array so both parts go on separate lines; 我只是想知道如何吐出阵列,使两部分都在单独的行上。

Live The Dream More 梦想成真
And Even More 甚至更多

Just incase any one would like to know I have sorted this issue for getting a break point for my project any way. 以防万一有人想知道我已经解决了这个问题,以任何方式为我的项目找到了一个断点。 What I did was use the content control as plain text and then set the properties to "Allow carriage returns". 我所做的是将内容控件用作纯文本,然后将属性设置为“允许回车”。 From there I use the code 从那里我使用代码

StringBuilder Builder = new StringBuilder();

        string Spacing = Environment.NewLine;

        string newline = "";

        foreach (string s in ArrSkills)
        {
            newline = string.Format("{0}{1}", Spacing, s);

            foreach (var Item in newline)
            {
                Builder.Append(Item);
            }
        }
        GetSkills = Builder.ToString();

with allowing Allowing carriage the method for Environment.NewLine allows a line break 允许运输的方法Environment.NewLine允许换行

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM