如何在报表上分隔表格和图表

时间:2013-12-28 01:20:41

标签: c# reporting-services

使用Reporting 2008,我已根据Tablix定义了一个图表,并希望将其导出为pdf。我正在动态生成rdlc,因为数据源和其他设置预计会发生变化。 Tablix和图表确实都是生成的,但Tablix是放在图表的顶部,而不是在它之后?除了进行分页操作外,我如何将它们分开?

BodyType仅包含这些属性

    [System.Xml.Serialization.XmlElementAttribute("Height", typeof(string), DataType="normalizedString")]
    [System.Xml.Serialization.XmlElementAttribute("ReportItems", typeof(ReportItemsType))]
    [System.Xml.Serialization.XmlElementAttribute("Style", typeof(StyleType))]

和这些的ReportItemsType,我没有看到任何明显的分隔选项。

    [System.Xml.Serialization.XmlAnyElementAttribute()]
    [System.Xml.Serialization.XmlElementAttribute("Chart", typeof(ChartType))]
    [System.Xml.Serialization.XmlElementAttribute("CustomReportItem", typeof(CustomReportItemType))]
    [System.Xml.Serialization.XmlElementAttribute("GaugePanel", typeof(GaugePanelType))]
    [System.Xml.Serialization.XmlElementAttribute("Image", typeof(ImageType))]
    [System.Xml.Serialization.XmlElementAttribute("Line", typeof(LineType))]
    [System.Xml.Serialization.XmlElementAttribute("Rectangle", typeof(RectangleType))]
    [System.Xml.Serialization.XmlElementAttribute("Subreport", typeof(SubreportType))]
    [System.Xml.Serialization.XmlElementAttribute("Tablix", typeof(TablixType))]
    [System.Xml.Serialization.XmlElementAttribute("Textbox", typeof(TextboxType))]

我有类似的东西(abbreviating),我可以通过指定Left和Top参数来控制位置,但是如果图表的大小是动态的,那该怎么办呢。无论图表大小如何,我正在寻找的东西会自动将表格放在图表之后。

    private Report CreateReport()
    {
        Report report = new Report();
        report.Items = new object[] 
            {
                CreateDataSources(),
                CreateBody(),
                "6.0in",
                CreatePage(),
                CreateDataSets(),
            };
        report.ItemsElementName = new ItemsChoiceType80[]
            { 
                ItemsChoiceType80.DataSources, 
                ItemsChoiceType80.Body,
                ItemsChoiceType80.Width,
                ItemsChoiceType80.Page,
                ItemsChoiceType80.DataSets,
            };
        return report;
    }

    private BodyType CreateBody()
    {
        BodyType body = new BodyType();
        body.Items = new object[]
            {
                CreateReportItems(),
                "10in",
                CreateBodyStyle(),
            };
        return body;
    }

    public StyleType CreateBodyStyle()
    {
        StyleType style = new StyleType();
        return style;
    }


    private ReportItemsType CreateReportItems()
    {
        ReportItemsType reportItems = new ReportItemsType();
        TableRdlGenerator tableGen = new TableRdlGenerator(o_View);
        ChartRdlGenerator chartGen = new ChartRdlGenerator(o_View);
        tableGen.Fields = m_selectedFields;
        reportItems.Items = new object[] { chartGen.CreateChart(), tableGen.CreateTablix()             return reportItems;
    }

    public TablixType CreateTablix()
    {
        TablixType table = new TablixType();
        table.Name = "Tablix1";
        table.Items = new object[]
            {
                CreateTablixBodyType(),
                CreateTablixColumnHierarchy(),
                CreateTablixRowHierarchy(),
                "MyData",
                "3.5in",
                "0.125in",
                "0.5in",
                "6.5in",
                CreateTablixStyle(),
            };
        table.ItemsElementName = new ItemsChoiceType73[]
            {
                ItemsChoiceType73.TablixBody,
                ItemsChoiceType73.TablixColumnHierarchy,
                ItemsChoiceType73.TablixRowHierarchy,
                ItemsChoiceType73.DataSetName,
                ItemsChoiceType73.Top,
                ItemsChoiceType73.Left,
                ItemsChoiceType73.Height,
                ItemsChoiceType73.Width,
                ItemsChoiceType73.Style,
            };
        return table;
    }

0 个答案:

没有答案