Sample code to create Pivot table in open XML SDK - asp.net

I am trying to create a pivot table in excel using the open XML SDK from my .net web application. I have got an excel file, for which I have to generate a pivot table.
Please provide any sample code.

I have some similar task.
Take a look at this Power Tools for OpenXML.
It really helped me, although now I need to figure out how to initialize the pivot table with some structure.
PS. you might need to expose this from a webservice.

Related

How to use data retrieved from a web API?

I have a simple concept where I want to retrieve a table from a website and use it in that exact format. This can be for example imported into Excel.
This is the website that I want to get the table from:
http://www.dota2.com/leaderboards/#europe
This is the API that the website uses to get the data:
http://www.dota2.com/webapi/ILeaderboard/GetDivisionLeaderboard/v0001?division=europe
In all the ways I attempted to get the data from the website, it is poorly formatted into one line, and I was wondering what is the best way to format/use this data through code or other tools available. I have tried:
Excel web importing
Writing a simple VB program to read each line (but it reads it all as one line)
Copy and pasting the table to Notepad to try format it by line(still one single line)
Any tips/suggestions regarding any form of website data retrieving is very much appreciated.

How to mimic an excel spreadsheet on a website in vb.net?

I am building a website to capture data. I have many spreadsheets that are used for data entry or capture. Now I want to mimic these complex spreadsheets on the web forms but I am unsure of the correct control to use.
Data entry must be allowed and live calculations also need to be made similar to formulas on normal excel spreadsheets. Later on the data must be captured into an SQL table.
What would be the best control to use or method to mimic that functionality, albeit that the spreadsheet component is no longer available in visual studio 2010. Is it a data grid?
Thanks
for custom build you can rely on GridView and keep adding on features to it.
however my reccomendation would be to use Devexpress Grid or some other third party controls and build on it. these controls are more feature rich :)
Here is an extension that contains Excel compatible WinForms. Capturing to SQL should be pretty straightforward using the Entity Framework.
http://visualstudiogallery.msdn.microsoft.com/03A0E5A9-4768-461C-9A72-8255A291094C?SRC=Featured
Check to see if the Office Web Components at http://en.wikipedia.org/wiki/Office_Web_Components#Office_Web_Components will meet your needs.

Mailmerge in asp.net

How to do a mail merge in asp.net without installing word on the server?
any dlls or any components available?
Edits
The template document is already available. im not trying to create a word document. Just want to link the word document with the data.
Thanks
Personally, I would just look at using the System.Net.Mail class and its templating abilities. There is a nice library here: https://github.com/lukencode/FluentEmail which you can pass templates into and send emails that way with the data you require inserted into it.
EDIT: noticed you didn't actually specify whether it was print mailmerge or email, apologies if it is a print mailmerge you are trying to create, but for mass emailing with customized data in it, templating is definitely the way to go.
To accomplish the Word doc creation part of the question there is a previous thread about this: How can a Word document be created in C#?
To send the completed doc check out the System.Net.Mail namespace: http://msdn.microsoft.com/en-us/library/system.net.mail.aspx or if you can afford it I have had great experience with http://www.aspnetemail.com/.
We use Aspose.Words to perform mail merges from .net code. It's not cheap but once you get to grips with it it's very powerful.
Edit: I'm assuming you are looking to merge data from some sort of data store into a template word document which can be printed and distributed.
Another option is Docentric Toolkit. It is pure .NET and based on OpenXML without any dependency on MS Word, so it is a good fit for server side report generation.
Merging with data is done through placeholders, which get filled up with data at run time. Data can come from database or XML.
Templates are created in MS Word which needs Docentric Toolkit add-in installed (license is needed).
It is really easy to create templates and to merge them with data from .NET code.

Export Excel from web, what's the BEST way?

About 3 years ago, I was looking for a way to allow a web app user to download table results to an Excel file. I knew that I didn't want to put Office on the web server and that I probably wanted to create the XLS file in XML format. The question was: what was the best way?
Now I am writing my resume and I am trying to recap the things that I did and I am concerned that I didn't take the best approach and I am wondering if somebody can tell me whether my suspicions are true.
Basically, I saved an Excel file as XML and then looked at the contents of the saved file and reverse engineered what I thought was a pretty cool SDK to create an Excel file in XML format. It was fairly robust with options , nice object model, etc.
But did such a library already exist? One that I could have used? I want to know if I will need to defend this "accomplishment"
Also, could anyone recommend me a good place where I can see actual resumes of people with .NET / SQL Server or general developer skills?
You can try SmartXLS (for Java or .Net), it supports most features of Excel (cell formatting, Charts, formulas, pivot tables etc), and can read/write both the Excel97-2003 xls format and the Excel2007 openxml format.
These people wrote a perfectly good one that you probably couldn't implement yourself for as cheaply.

Filehelpers Excel to Oracle db

I want to import excel data to oracle DB. I got enough help for Excel part, can you guys help me in Oracle side?
Is it possible to import to oracledb with filehelpers? Please provide some sample code for reference.
Thanks
Dee
If you save the spreadsheet data as .csv files it is relatively straightforward to import it into Oracle using SQLLoader or external tables. Because we can use SQL with external tables they are generally eaiser to work with, and so are preferable to SQLLoader in almost all cases. SQL*Loader is the betterchoice when dealing with huuuuge amounts of data and when ultra-fast loading is paramount.
Find out more about external tables here. You'll find the equivalent reference for SQL*Loader here.
A simple and relatively fool-proof way to do that for one-off tasks is to create a new column in the excel sheet, containing a formula like that:
="insert into foobar values('"&A1&"','"&A2&"');"
Copy that to all rows, then copy the whole column into an editor and run it in SQL*Plus or sql developer.
I am using Sqlloader to upload data from CSV to Oracle DB.

Resources