General question - copy, cut, paste - copy-paste

How do the applications transfer the copied strings into each other? Is this a clipboard usage? If so, how can i access the clipboard in a program?
Edit: I'm interested in Windows systems, I know a bit of C#, and C++.

Yes, cut-and-paste is usually done using the system-wide clipboard.
In both Windows Forms and WPF applications, there are (different) classes called 'Clipboard', which contain the stuff you need to access the system clipboard.
Basically, the clipboard allows you to put pretty much anything on to it, along with markers that say what format the data is in. You can put the same data on in lots of different formats. That's how, for example, you can cut and paste a part of a spreadsheet in Excel into Notepad - Excel has put the data onto the clipboard in both a native Excel format and a plain text format.

Related

Parsing XPS or PDF and inserting data into a Word Template?

So, I have an option of sending a document from a database to print either in PDF or XPS. I need to be able to extract specific data, such as name, date, etc. from one of those formats and inserting that data into a word template. The word template is not editable. You can only type within fields... each field has a heading before it, such as name, dob, etc.
Basically I need to be able to automate transferring that information from the PDF or XPS file into the word template.
I'm familiar enough with C++, Python and Java.. so I have no language preference -- whatever gets the job done.
Could you suggest a way I can manage to accomplish this? I've having a bit of a difficulty figuring out the way I can parse/extract data from one of those file types and which file type would be a better candidate. And I definitely have no idea how I can automate the population of fields in the Word Template.
Oh and forgot to mention, this is on Windows 7 (and maybe 8, but mostly 7) machines.
Thank a lot for your help in advance!
This is for anyone who has the same sort of question, so this is how I did it:
I used PDFBox (http://pdfbox.apache.org/) to parse the document and extract the needed data and then I used docx4j (http://www.docx4java.org/trac/docx4j) to insert data into word template. Both are incredible tools and have excellent communities that help out almost immediately.

How do I store and view graphically formatted data?

I have an app (written in D2010) which is similar to a text retrieval app... It has a list of questions, with their corresponding answers. Most answers are strictly text, but some answers have graphics, and formatting. My dilemma has to do with the formatted answer. The user should be able to copy this answer (formatting and graphics) in order to paste it into another app. I have tried using a Word OCX. This is a little problematic. User has to have word, it gives random errors when using inside a virtual machine, etc. I am now playing with using a built in browser component, and viewing the data as a PDF. This is nice and easy, but when I copy and paste it, I loose all formatting, and the graphic shows up as a large totally black box.
I can store the data in whatever format I choose. It is stored as a BLOB in a DB file. I write it to a temp file and then I call some type of viewing routine, so I have flexibility there. My issue is really, what viewer mechanism is simple to implement, and allows copying/pasting, while maintaining text formatting (bullets, indents, etc) and graphics.
Thanks,
GS
The TRichEdit (or any of TRichEdit descendants or similar classes) will allow the users to visualize text formatting and images, and when the content is copied, the RTF representation of the data will be copied into the clipboard.
When the clipboard data is pasted into a RTF compatible text editor (like Wordpad and Word), all the formatting, bullets and images are preserved.

Can I create a .xls file programmatically in iOS?

I need to create a .xls file from the Array data programmatically in iPhone. How can this be done?
Maybe you're in trouble, maybe not. The "old" xls format is a binary one and I am not aware of any free libraries which are able to read or write to that format. If this one is required, you're propably out of luck.
If however a more recent format will do you're back in business, because you can use xml (objc wrappers for lib2xml are readily available). Wikipedia features a short overwiev of the format which you might want to check out: Excel file formats on Wikipedia

Binary Serialized File - Delphi

I am trying to deserialize an old file format that was serialized in Delphi, it uses binary seralization. I know nothing about the structure of the file except some very high level records that are in it.
What steps would you take to solve this problem? Any tools etc?
A good hexeditor, and use the gray matter to identify structures.
If you get a hint what kind of file it is, you can search for more specialized tools.
Running the unix/Linux "file" command can be good too (*) See Barry's comment below for how it works. It can be a quick check for common filetypes like DBF,ZIP etc hidden by using a different extension.
(*) there are 3rd party builds for windows, but they might lag in versions. If you can do it on a recent *nix distro, it is advised to do so.
The serialization process simply loops over all published properties and streams their value to a text file. If you do not know the exact classes that were streamed to the file you will have a very hard time deserializing the file. (if not impossible)
A good hex editor is first. If the file is read without buffering (eg read directly from a TFileStream) you could gain some information when using ProcMon from SysInternals; You can see exactly what data is read in what chunks and thus determine more quickly where the boundaries are between the structures you already identified.

Changing EDI files by opening in XLS

I have a EDI file ...i want to test it ....so when I open it it opens in an EXCEL file,....there is some data I want to change....
BGS~EGI~PG~265\TIA~5008~~~16796~GA\BGS~EGI~PG~360\TIA~5008~~~22827~GA\BGS~EGI~PG~528\TIA~5008~~~18304~GA\
TO
BGS~EGI~PG~265\TIA~5008~~~0~GA\BGS~EGI~PG~360\TIA~5008~~~0~GA\BGS~EGI~PG~528\TIA~5008~~~0~GA\
Can it be done on EXCEL and the changes reflect in the EDI sheet?If do that in EXCEL and save ....how to save it?I did that but did not know which format to Save....xlt/xls/ etc. I save it as .xlt format.Is that the correct way?
Further the cursers just goes hay way when i click on a cell. How to control the cell?
pLEASE HELP
ATorras is on the right path. EDI is sort of a text format. I'd call it more of a binary format. (There's also XML EDI, but that's not what you're dealing with here.)
Depending on the size of the file, you may run into line limits in some editors. Others may be adding line breaks that may or may not cause issues with some EDI translators.
You can have EDI files with binary delimiters (such as segment terminators). This is not common, and it doesn't look like the case with your test data.
The file extension only matters to the translator or other software that's trying to find/send the EDI file. Basically you don't want to change the original extension.
I don't remember what the standards are for Unicode, etc., so that may be a concern in some cases. You'll want to preserve whatever encoding the original file uses.
Short version: Most of the time you can get away with using Notepad, vi, etc. Sometimes you can't. If you have access to dedicated EDI tools for parsing/editing/translating, use those. Never use Excel or Word. Always make a backup of your original first. Verify that your trading partner is getting what you expect.

Resources