Hello everyone,
I've downloaded
this source code, from
this website.
It reads an xml file which acts as a dataset and automatically generates and prints RDLC file through reportViewer control in C#. I want to make a more complex version of rdlc generator.
Definitions are automatically generated by xsd.exe ("C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\xsd.exe" /c /namespace:Rdl ReportDefinition.xsd)
In TableRdlGenerator.cs there is a method called CreateHeaderTableCellTextbox() and I wrote my own method CreateHeaderTableCellRectangle() which would create rectangle insted of a textbox for each header cell.
private Rdl.
RectangleType CreateHeaderTableCellRectangle(
string fieldName)
{
Rdl.
RectangleType headerTableCellRectangle = new Rdl.
RectangleType();
headerTableCellRectangle.Name = fieldName +
"_Header";
headerTableCellRectangle.Items =
headerTableCellRectangle.Items =
new object[]
{
"3.25cm",
3,
"5.75cm",
"5cm",
CreateHeaderTableCellRectangleStyle(),
"2.20cm",
};
headerTableCellRectangle.ItemsElementName =
new Rdl.
ItemsChoiceType12[]
{
Rdl.
ItemsChoiceType12.Left,
Rdl.
ItemsChoiceType12.ZIndex,
Rdl.
ItemsChoiceType12.Top,
Rdl.
ItemsChoiceType12.Width,
Rdl.
ItemsChoiceType12.Style,
Rdl.
ItemsChoiceType12.Height,
};
return headerTableCellRectangle;
}
and CreateHeaderTableCellRectangleStyle() which looks like this
private Rdl.
StyleType CreateHeaderTableCellRectangleStyle()
{
Rdl.
StyleType headerTableCellRectangleStyle =
new Rdl.
StyleType();
headerTableCellRectangleStyle.Items =
new object[]
{
"Black",
"Solid",
"
3pt",
};
headerTableCellRectangleStyle.ItemsElementName =
new Rdl.
ItemsChoiceType5[]
{
Rdl.
ItemsChoiceType5.BorderColor,
Rdl.
ItemsChoiceType5.BorderStyle,
Rdl.
ItemsChoiceType5.BorderWidth,
};
return headerTableCellRectangleStyle;
}
But there's an error generating rdlc, and I'm not sure why. Creating rectangle within a table cell through visual studio designer is easy. When I save that rdlc file and view it's xml content, structure is very close to the one that I get with when I use CreateHeaderTableCellTextbox(), except that within a style tag there's another style tag (BorderStyle). Maybe that's the problem? Do I need to somehow make a style witin a style?
This is an example of textbox reportItem which was generated with CreateHeaderTableCellTextbox():
<Textbox Name="Category_Header"> <Value>Category
</Value> <Style> <FontWeight>700
</FontWeight> <FontSize>14pt
</FontSize> </Style> <CanGrow>true
</CanGrow></Textbox>And this is how Rectangle reportItem looks like in a rdlc which i designed in VS:
<Rectangle Name="rectangle1"> <Left>3.25cm
</Left> <ZIndex>3
</ZIndex> <Top>5.75cm
</Top> <Width>5.07937cm
</Width> <Style> <BorderStyle> <Default>Solid
</Default> </BorderStyle> <BorderWidth> <Default>3pt
</Default> </BorderWidth> </Style> <Height>2.53968cm
</Height></Rectangle>How can I generate rectangles?
Thank you for your time,
Vlad