多个section加载数据问题
版主您好:现在我在textcontrol里面添加了多个section,每个section设置了不同的页眉。
我现在想要根据在设置不同的seciton(页眉)加载不同的数据(因为数据是html格式,里面还包涵图片,所以要用load方法而不能用textfield来添加数据)。代码如下:
List<Article> list = GetList();
textControl1.HeadersAndFooters.Add(TXTextControl.HeaderFooterType.Header);
for (int i = 1; i <= list.Count; i++)
{
if (i != 1)
{
textControl1.Sections.Add(TXTextControl.SectionBreakKind.BeginAtNewPage);
}
textControl1.Sections.Format.Landscape = false;
textControl1.Sections.HeadersAndFooters.GetItem(TXTextControl.HeaderFooterType.Header).ConnectedToPrevious = false;
TXTextControl.Selection mySelection = new TXTextControl.Selection(0, -1);
mySelection.Text = list.title;
textControl1.Sections.HeadersAndFooters.GetItem(TXTextControl.HeaderFooterType.Header).Selection = mySelection;
textControl1.Load(list.content, TXTextControl.StringStreamType.HTMLFormat);
运行会报错(未将对象引用设置到对象的实例),应该是因为load方法修改了textcontrol的text属性而导致无法使用多个section,从而在第二次循环的时候获取不到section对象了。不知道版主能否证实我的猜想。
请问版主,如果我想要根据不同的section来加载(load方法)不同的数据,还有其他的解决办法吗? kitara 你好
我试着用你提供的代码片段重现该问题,但是我无法重现,能否给我发送一个可以重现你问题的示例工程和测试文档,这样可以加快问题的调查进度。
页:
[1]