I am using MS Word to create template for PDF file.
Here is my file structure:
Now I expect all headings (i.e attendance key details, units, semaphores, sanction - big bold texts) are repeated across pages. But I have no idea how to do that. Does anyone know?
My question has 2 parts.
Part 1:
I have 3 Excel files each with multiple sheets. I have loaded all files with sheets into the matlab using a small code. The files are loaded in a structured form. i.e. One main structure and 3 files as a seperate fields with multiple sheets as a value.
Part 2:
Now I have another seperate excel file having a single sheet with a single column. The col of this excel file has entries(or values/names) which are linked to each file of part one. In other words each excel file of part 1 is a data of each entry of a column of excel file in part 2.
Now my problem is that I want to link both of them. This is important because in further processes I want my program to run in a way that when I specify the value or tell the entry from excel file of part 2 it takes corresponding data from excel file of part 1. Is there any way of doing it?
This block diagram may be helpful to understand what I mean. BLock Diagram
I should create a new pdf , for example a offer. At the end of the new pdf i have to import several existing pdfs, these pdf has form fields and i must fill up this fields.
One problem is that the different existing PDF has all the same form fields e.g txtNAME.
Is there a possibility to add existing PDF in a open document and fill up formfields directly?
Thank for help or ideas
Just keep in mind that fields with the same name will have the same value.
This can be a boon (if you did some thinking ahead when you planned the forms), but it also can be a hindrance.
One possibility you may have, if the number different additional pages is not too high: You might prepare a "master form", which contains the subsequent pages as hidden Templates, and then when you create your document, you will spawn the according pages with the option to make unique field names.
I would like to embed one Word document (call it "hidden.docx") into another Word document (call it "host.docx"). The document hidden.docx would not be visible at all when host.docx is opened in Word by an end-user. Document hidden.docx would only be carried inside host.docx, sort of as unstructured cargo data.
All research I have done points me to the use of something called altChunk offered by the Open XML SDK. I have installed Open XML SDK and got a sample working: http://msdn.microsoft.com/en-us/library/gg490656%28v=office.14%29.aspx
My question: In order to insert an altChunk into a docx, do I really need the Open XML SDK? Can this not be accomplished using VSTO? If so, how?
[PS: My ultimate goal is, for a pair of documents where one document is the original text and the other is its translated version in another language, to be able to preserve the original document within the translated document, so as not to lose it. For any document pair, there's always the risk that the two documents become separated through misplacement of one of them.]
Yes and No.
1.) That's not what AltChunks do. AltChunks are a way to embed one document into another document such that they get merged together. They are not hidden. If you create a docx package with an AltChunk in it, and then open up Word, Word will immediately merge that AltChunk into the document. (If that AltChunk is another Word document that also contains child AltChunks they will be recursively merged into the parent as well.) Basically, it's an easy way to merge content together without having to reconsolidate all their styles, rIDs, etc. -- if you save the document and examine it, the AltChunk will be gone, and you will notice that Word has merged the document back together into a single document again.
2.) Range.InsertXML, if provided a valid Flat Package for a full Word document will, under the hood, invoke that same merge functionality (down to having the same bugs, etc.) that you would get from an AltChunk. The two behave identical, and you can even create a document package with the OpenXML SDK that contains embedded AltChunks, and insert those (I've done this in Word 2007, 2010, and 2013) -- of course, as I mentioned above, the AltChunks are never persisted, they're immediately merged into the document.
If you want to save hidden data in a document, I recommend using Custom XML (take a look at Document.CustomXMLParts). Keep in mind though, at least in Word 2010, Undo does not revert changes to CustomXML parts.
If you simply want to include some file into the Open XML package, then the simplest way is to use API from the System.IO.Packaging namespace (First obtain the reference to the main document part of the host part):
EmbeddedPackagePart hiddenDocumentPart = mainDocumentPart.AddEmbeddedPackagePart(#"application/vnd.openxmlformats-officedocument.wordprocessingml.document");
hiddenDocumentPart.FeedData(File.Open(hiddenDocumentFile, FileMode.Open));
Just to be sure, this way the hidden document will be in no way part of the host document content. It will only be part of its file (package). You can later extract it with a similar method: Get the main part of the host document, find the embedded (hidden) part and get/read the data from it.
I have a fillable PDF form which needs to be programatically filled for each member and added to a single pdf document.
I am able to use pdfstamper to read the existing pdf, and change the data, but I cant seem to figure out how to create multiple instances of the pdfstamper with different data in the same pdf doc.
You don't. One PDF stamper->1 document OUTPUT. You didn't give a lot of detail, but your workflow will probably need to be something like this:
For Each PDF form:
* Open it with a Stamper
* Fill it in
* turn on flattening
* Save it (to memory or disk)
Create a PdfCopy (or SmartCopy)
For each intermediate PDF
* Insert it into Pdf*Copy
Save your final doc.
None too efficient, but that's how it works with iText.
PS: You really do need to flatten your forms when merging multiple forms together, PARTICULARLY when you have multiple copies of the same form. In a PDF, fields that share a name also share a value.