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).
Related
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?
I want to convert this pdf page this is the pdf screenshot to .xls file along with the columns.
You should be able to use a PDF parsing library to extract the text. This could be very easy to impossible. It depends on how the table is represented internally. If it is represented as an image you will also need an OCR library. In the easiest case you could just extract all the text as a string and split rows according to newlines and columns according to tabs or other whitespace.
Try this one and see what happens: http://www.squarepdf.net/parsing-pdf-files-using-itextsharp
Edit: I focused on the reading the PDF part. The writing to Excel is more than covered with a quick google search.
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.
I am exporting some data from my database in xml format.
The file exported has an extension as .xml and it is viewed as Excel file.
I want to insert an image in this xml file so that when we view it as Excel we will be able to see the image along with the data.
Whatever I have found from the internet is that there is no straight forward way to insert an image in xml file as xml file were designed for handling the data.
Can any one tell me what is the approach I will have to follow in order to obtain the desired functionality.
xml files are text files, and you can embedd binary data if you encode it with Base64 algorithm.
But to view the image you will need to decode the Base64-string and pass the result binary data to an image viewer implementation.
It cannot be done in MS Excel. You will need to implement your own viewer.
You won't be able to view an image inside of an XML file unless you write a dedicated application for it that knows about your particular requirement.
The reason is that XML is character-based, but images are not - they are binary data. A way to embed your image nevertheless is to transform it to something character-based first. For example, you could Base64-encode your image first and embed the resulting string in your XML. But I suppose there is no way to tell Excel to interpret this data as an image right away.
Because embedding binary files into XML using Base64 is such a common idiom, XML Schema even has its own data type for this: base64Binary.
I have binary stored in database. Now I want to convert it to a word doc. I have tried with ASCII encoding but it adds some special characters or symbols in between and doesn't look good.
For example I have resumes in doc and I have saved them in an sql database in binary[] format. Now what I want is to convert that binary to word compatible format and display it in an editor/textarea.
A Word .doc document is not a text file. It contains lots of binary data, the stuff that keeps track of styles, fonts, paragraph formatting, etcetera, etcetera. Which is the junk you see. You cannot realistically read such a file yourself, or for that matter display the document accurately, you have to use Word. You can automate it with the classes in the Microsoft.Office.Interop.Word namespace.
An intermediary solution is to store Word documents in the RTF file format. As long as the formatting doesn't get too fancy, a RichTextBox can display it accurately. Storing it in a dbase column isn't hard either, it is text.
Word document is pretty much Proprietary and closed format, operating with meaning there is no such an interface to pass an array of bites that word understands and get a string out of it.