Click here to Skip to main content
15,892,005 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hi,
I want to export the c# datatable to excel pivot table.The exported pivot table should be editable means user can edit values in pivot cells.The changed value must automatically be reflected in grand totals.
I want this using c#.Can anyone help?

Thanks,
Surbhi
Posted
Comments
DamithSL 6-Nov-14 4:20am    
what is the problem? what have you tried so far?
SurbhiA 6-Nov-14 4:44am    
Hi,
Thanks for replying.
I have tried Excel.Interop but it doesn't update grand totals automatically on changing value of Data Field.
Now I am trying to use openxml sdk but my excel is not generating properly and I am unable to find sample code for same.

Thanks,
Surbhi
Maciej Los 6-Nov-14 16:07pm    
"The changed value must automatically be reflected in grand totals" - On what level: Excel or your application?
SurbhiA 7-Nov-14 0:50am    
The values are changed in excel and should be updated in excel.Same for grand totals
Maciej Los 7-Nov-14 2:16am    
Why do you want to use Excel? Wouldn't be better to use your application?

1 solution

I'd like to say that you're able to achieve almost the same functionality what Excel does have. Let's say, you need to create editable gridview. That's all!
It's bad idea to use third party application (like Excel), because of many factors:
1) you can't (fully) control it,
2) you need to export data to Excel than to import them to your database, which means unnecessary data movement,
3) etc.

Have a look at my previous answer: Replace string in statment[^]. There is a lonk to very interesting article abour "calculation engine".
If you want to know how to achieve Sum column, please use a SearchBox[^].
To create pivot table, use SQL PIVOT[^] statement.
Simple Way To Use Pivot In SQL Query[^]
Pivots with Dynamic Columns in SQL Server 2005[^]
Pivot tables in SQL Server. A simple sample.[^]

Try!
Good luck!
 
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