如果要使用tl.items,必须设置tl.rangeExpression。
参考代码:
ThemeLabel tl = new ThemeLabel();
tl.labelExpression = "Country";
tl.rangeExpression = "SmID";
tl.items = new ThemeLabelItem[2];
tl.items[0] = new ThemeLabelItem();
tl.items[0].start = 1;
tl.items[0].end = 147;
tl.items[0].style = new TextStyle();
tl.items[0].style.bold = true;
tl.items[0].style.italic = true;
tl.items[0].style.color = Color.sysColorToServicesColor(java.awt.Color.RED);
tl.items[0].visible = true;
tl.items[0].caption = "caption0";
tl.items[1] = new ThemeLabelItem();
tl.items[1].start = 147;
tl.items[1].end = 247;
tl.items[1].style = new TextStyle();
tl.items[1].style.bold = true;
tl.items[1].style.italic = true;
tl.items[1].style.color = Color.sysColorToServicesColor(java.awt.Color.YELLOW);
tl.items[1].visible = true;
tl.items[1].caption = "caption1";