Converting PDF values to excel in specific format - c#

I have some plain data in a PDF as shown below.
I need to get this data and convert it to put in an excel file like this
I am confused if there is a direct method in Microsoft Excel 2007 and above to directly take values from PDF and paste it in this format.
So far what I've tried is itextSharp with C# coding. It doesnot seem to support convertion from PDF to excel and even though I've tried, I couldnot get in this format of excel. I shall put updates to my further findings in this question itself.

Related

C# How to create an Excel 5.0/95 file

I need to create (save) an Excel 5.0/95 file with C# (to be use by an old software), but I'm stuck in not finding the necessary library.
Till this point I always used "EPPlus" (for .xlsx format) and "Excellibrary" (.xls format Excel 97-2003), and couldn't find a way to change the format in any of these two to save the Excel in 5.0/95.
Someone know how to do this?

Paste-Link Excel ranges into C# app

I am writing a C# app where I need to paste/link tables/ranges from existing Excel documents.
Functionality that I am looking for is this:
user can select a range of cells in an open Excel doc and do a Copy
user switches to my C# app and does a past-link ... my app shows the table from Excel.
user can edit the source Excel doc - this does not automatically get reflected in the C# app. But I want to provide a Refresh button that when clicked will update the C# app based on the latest data from the linked Excel sheet.
I have figured out how to do a basic copy/paste. I cannot figure out how to do this paste-link. Please note I do not want to ask user in my C# app for any cell ranges..I simply want to do paste-link of what is already in the clipboard...
Any ideas if this can be done...it is all Microsoft so I would be surprised if it can't be.. but I am a C# novice.
Thanks for all input.
I figured it out. Here are the steps.
User copies a range in Excel sheet. It goes to Clipboard in a number
of formats but CSV and ObjectLink formats are of particular interest.
In C# app, trigger a Paste-Link function (this is any button).
Retrieve data from Clipboard using ObjectLink format. This comes out as text which contains:
Excel version identifier
Path to the excel file
The sheet name and the selected range in R1C1 notation
Save the ObjectLink data in your C# app, we will use it later as part of refresh
Retrieve the data from clipboard using CSV format. Parse it out and present in C# app. I converted it to HTML since this is what I am building
Modify the original source excel file - change something in the cells that were part of the original range - save the file.
Go back to C# app, trigger Refresh functionality (this is any button). IN your code do the following:
Using ObjectLink data saved in step 2, open the Excel sheet in the background using Excel Interop API tools. Select the sheet and range. Copy the range programmatically to clipboard.
invoke the same copy from clipboard as used in the last step of 2. Basically get the updated Excel data in CSV format from clipboard and replace the original representation you built during step 1.
This works like a charm although the COM part of opening an excel doc from C# is a bit slow I have to admit.
I have not found any references to this procedure on the net...works for me like a charm.
Cheers.

How use clipboard to move data from .NET application to Excel?

Which is Excel's preferred format for receiving data from the clipboard? The data is in a C# / .NET application.
I had been saving to the clipboard in CSV format, but now I want to start giving Excel formatting information (eg. make some cells bold). CSV format is no longer enough.
When I copy from Excel, the clipboard holds 24 formats!
System.Windows.Clipboard.GetDataObject().GetFormats().Dump();
EnhancedMetafile
System.Drawing.Imaging.Metafile
MetaFilePict
Bitmap
System.Drawing.Bitmap
System.Windows.Media.Imaging.BitmapSource
Biff12
Biff8
Biff5
SymbolicLink
DataInterchangeFormat
XML Spreadsheet
HTML Format
Text
UnicodeText
System.String
CSV
Rich Text Format
Embed Source
Object Descriptor
Link Source
Link Source Descriptor
Link
Format129
*
I believe what you're seeing is that Excel prepares the data when you copy to the clipboard in many different formats depending on where you end up pasting it. You probably need to look into the Office XML format for Excel.
See this example xml at Wikipedia for a better idea of the format. While I've never used it before, I'm pretty sure Excel would simply let you paste in the XML directly (if it's the right schema).

How to convert PDF to Excel in C#?

I want to read tables which are in a PDF document and I want to store these values in a Database.
What I have found so far through searching the web:
Read text from PDF using abcpdf .net, which is freeware available. But it's not right solution because I want to read the tables.
Convert PDF document into Excel/Word. Tables will come in the target document as it is. Word conversion is possible by using EasyPDF Converter which is third party tool which is much cheaper than the other solution available in other tool which converts PDF into Excel.
But I am looking for any other solution/API classes which can convert PDF into Excel.
There are 2 possible solutions
a) Cometdocs makes a free online conversion from PDF to XLS surprisingly good and send for your email the result file.
b) Cognview is a comertial shareware that converts PDF to XLS. There is OCR and text version. I didn't use personally, but they have good recomendations.
If you are looking to upload your data into a database, converting your PDFs to CSV is probably the safest option. The PDFTables API will allow you to do this with C#, converting as many PDFs at once as necessary. https://pdftables.com/pdf-to-excel-api#csharp
You can try to use Quablo, a PDF table extractor available at this web page (link updated/corrected).

Export Data to Excel without Server-side install

I want to export my data from grid view to the excel. Unfortunately i came to know that there is no excel software on server side. Is there any way that i can still export data in excel format without having excel software on server side.
Thanks.
you can create a CSV format text file, which excel can understand.
This question also outlines some other options you might be able to use, with pros and cons of both.
This must be one of the most asked questions on Stackoverflow.
See Create Excel (.XLS and .XLSX) file from C# For lots of suggestions and a whole list of linked questions.
One trick you can use it to export the html table to the client with the extension of .xls. When the user opens the document with Excel and resaves it will become a real excel document. The fun part is it will retain most of the formatting from the HTML view. This works with HTML/TABLES, I'm not sure about DIV/SPAN/CSS.

Categories