如何将字符串列表拆分为两列并将其附加到 c# 中的尖顶 pdf
How to split list of strings into two columns and append it to a spire pdf in c#
This is my list of data type string:
List<string> Questions = new List<string>();
I am appending list of static questions ,answers to the question values from model
Questions .Add("Q1? " + " : " + model.value);
Questions .Add("Q2?" + " : " + model.value);
string[][] datasource = new String[Questions .Count][];
for (int i = 0; i < Questions .Count; i++)
{
datasource[i] = Questions [i].Split(';');
}
将其附加到 spire pdf table:
PdfTable table = new PdfTable();
table.DataSource = 数据源;
我的输出:
实体申报的是什么类型的税 return? : 604 -- 在单列中
预期输出:
专栏 1 专栏 2
实体申报的是什么类型的税 return? 604
请注意,数组 "Questions" 的每个元素中只有一组数据,因此 table 只有一列。如果您想要两列的预期输出,请将您的代码更改为:
string[] Questions = { "Q1?:;model.value", "Q2?:;model.value" };
This is my list of data type string:
List<string> Questions = new List<string>();
I am appending list of static questions ,answers to the question values from model
Questions .Add("Q1? " + " : " + model.value);
Questions .Add("Q2?" + " : " + model.value);
string[][] datasource = new String[Questions .Count][];
for (int i = 0; i < Questions .Count; i++)
{
datasource[i] = Questions [i].Split(';');
}
将其附加到 spire pdf table:
PdfTable table = new PdfTable(); table.DataSource = 数据源;
我的输出: 实体申报的是什么类型的税 return? : 604 -- 在单列中 预期输出: 专栏 1 专栏 2 实体申报的是什么类型的税 return? 604
请注意,数组 "Questions" 的每个元素中只有一组数据,因此 table 只有一列。如果您想要两列的预期输出,请将您的代码更改为:
string[] Questions = { "Q1?:;model.value", "Q2?:;model.value" };