Click here to Skip to main content
15,892,480 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I have my own software for inventory management it's coded through C# . Now I need to implement micro-soft excel (.xlsx) pivot table function in my software which can be useful to create customized report preparation .

Regards
Kingshuk Roy

What I have tried:

unable to do , tried but i am not very much technically sound.
Posted
Updated 21-Dec-19 4:22am
Comments
[no name] 22-Dec-19 9:01am    
It's written in C#, but you didn't write it I take it.

We are more than willing to help those that are stuck: but that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for us to do it all for you.

So we need you to do the work, and we will help you when you get stuck. That doesn't mean we will give you a step by step solution you can hand in!
Start by explaining where you are at the moment, and what the next step in the process is. Then tell us what you have tried to get that next step working, and what happened when you did.
 
Share this answer
 
Comments
Member 14696479 21-Dec-19 7:39am    
I want to understand first that is it possible to implement , because pivot is a data summarization tool for a application .
So is it possible to apply same function in an individual software.
OriginalGriff 21-Dec-19 7:41am    
Yes it's possible.
But what have you tried?
Member 14696479 21-Dec-19 7:45am    
///
/// Gets a Inverted DataTable
///

/// <param name="table" />DataTable do invert
/// <param name="columnX" />X Axis Column
/// <param name="nullValue" />null Value to Complete the Pivot Table
/// <param name="columnsToIgnore" />Columns that should be ignored in the pivot
/// process (X Axis column is ignored by default)
/// <returns>C# Pivot Table Method - Felipe Sabino
public static DataTable GetInversedDataTable(DataTable table, string columnX,
params string[] columnsToIgnore)
OriginalGriff 21-Dec-19 7:52am    
So ... nothing then?
Patrice T 21-Dec-19 9:16am    
Use Improve question to update your question.
So that everyone can pay attention to this information.
and explain problem you have with this code.
There are two important pieces to your post which really need to be answered before any sort of plan can be developed:

1. How are you storing the inventory? Is this being done in Excel, or is the reference to Excel just a "helper" so that people know what you are trying to do.it in Excel, Access, or SQL. Each has benefi=OK, so you have your own inventory management system, and it is written in C#.

2. Where is this pivot table going to be? In this application or are you trying to add it to an existing Excel workbook.
Now if your data is in Excel and that is where you want the Pivot to be, you would probably be better off creating an Excel Template with the pivot table and then programmatically populate the source table, and fire off a refresh Macro. This would be more of VBA and could probably be answered better in an Office users' group.

Now, if "Excel" was only used as a reference to give us a visualize what you are trying to do....
If you are using Object (Orientated Programming) you may have heard of something called LINQ. There are many examples of how to use LINQ to create a Pivot, and there is an answer to another question here which has an example that may help:
Dynamic pivoting in linq C# MVC[^]

Then again, if you are using SQL Server for the data storage; you could create queries or stored procedures which can do the Pivot as well.
SQL Server PIVOT Operator Explained Clearly By Practical Examples[^]
The above can be expanded into many different scenarios and possible resolutions... And I hope you can now see that your question is missing important details that are necessary to properly help you out. This is not a "code-for-hire" service and even if it was there are dozens of possible solutions for you.

The best thing for you to do is to use the Improve Question widget below your original question to fill in the blanks as well as show the code you have so far relevant to the data you have and it's structure.
 
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