【问题标题】:designing a table inside xmlwriter在 xmlwriter 中设计一个表
【发布时间】:2014-10-04 08:29:41
【问题描述】:

我试图得到这个输出:

<thead>
    <tr><th>Condition</th><th>Effective Dates</th><th>Condition Status</th></tr>
</thead>

但我得到了这个:

<thead>
   <tr>
      <th>DX Code</th>
      <th>Date</th>
      <th>Code Type</th>
    </tr>
</thead>

我似乎无法让元素显示在一行上。 我的代码是:

  doc.WriteStartElement("thead");
  doc.WriteStartElement("tr");
  doc.WriteStartElement("th");
  doc.WriteString("DX Code");
  doc.WriteEndElement();
  doc.WriteStartElement("th");
  doc.WriteString("Date");
  doc.WriteEndElement();
  doc.WriteStartElement("th");
  doc.WriteString("Code Type");
  doc.WriteEndElement();
  doc.WriteEndElement();
  doc.WriteEndElement();

有没有办法像第一个示例一样获取格式?我尝试使用 WriteString,但它用 XML '&lt' 和 '&gt' 替换了所有的 ""

【问题讨论】:

    标签: c# html-table xmlwriter


    【解决方案1】:

    好的,通过调用 doc.WriteWhiteSpace("");在 ("tr") 元素之后。这会暂停缩进/换行,直到 ("tr") 元素结束。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-07-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-09-22
      • 1970-01-01
      相关资源
      最近更新 更多