如何将字符串列表拆分为两列并将其附加到c#中的spire pdf

时间:2017-04-17 05:22:45

标签: list c#-4.0 pdf-generation

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表:

PdfTable table = new PdfTable(); table.DataSource = datasource;

MY输出: 实体提交什么类型的纳税申报表? :604 - 单列 预期产量: column1 column2 实体提交什么类型的纳税申报表? 604

1 个答案:

答案 0 :(得分:0)

请注意,数组“问题”的每个元素中只有一组数据,因此该表只有一列。如果您想要两列的预期输出,请将您的代码更改为:

string[] Questions = { "Q1?:;model.value", "Q2?:;model.value" };
相关问题