Click here to Skip to main content
15,896,207 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hi Sir,

I downloaded your sample: PivotTableReport.aspx & PivotTableReport.aspx.vb.
I am exploring methods to export data from database into pivot table.

However when I try to run your sample code I hit the following error when I click on the link - "Export To Excel"

I get the following error:
Microsoft JScript runtine error: 'Worksheet(...).PivotTables(...).PivotFields(...).Interior' is null or not an object at the following lines - 

C#
WorkBook.Worksheets(2).PivotTables("PivotTable1").PivotFields("Name").Interior.ColorIndex = 10;
        WorkBook.Worksheets(1).PivotTables("PivotTable1").PivotFields("Age").Function = -4112;
        WorkBook.Worksheets(2).PivotTables("PivotTable1").DisplayImmediateItems = true;

        var ch1 = Sheet2.ChartObjects.Add(rang2.Left + rang2.Width, rang2.Top, 350, 220);
        ch1.Chart.ChartType = -4120;
        ch1.Chart.SetSourceData(rang2, 2);

        var ch1 = Sheet2.ChartObjects.Add(ch1.Left + ch1.Width, ch1.Top, 400, 250);
        ch1.Chart.ChartType = 95;
        ch1.Chart.SetSourceData(rang2, 2);

        var ch2 = Sheet2.ChartObjects.Add(rang2.Left + rang2.Width, ch1.Top + ch1.Height, 400, 250);
        ch2.Chart.ChartType = -4100;
        ch2.Chart.SetSourceData(rang2, 2);

        WorkBook.Worksheets(2).Name = "Pivot_Table_Report";
        WorkBook.Worksheets(1).Delete();
        WorkBook.Worksheets(2).Delete();
        WorkBook.HTMLProject.RefreshDocument();
        ExlApp.UserControl = false;
        ExlApp.Visible = true;
    }



Please assist me with the following. Your help is most apperiated!
Posted
Updated 22-May-11 5:09am
v2

1 solution

If you have a problem with some article that you found here then please post your question in the forum at the end of the article. The chances of the article's author seeing your question here are not high.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900