Convert Docbook To Pdf Windows 2000
Setting up a toolchain for working with Docbook on Windows often requires setting things up using Cygwin. Many people are just simply not willing to do that. This tutorial will show you how to set up a native environment to work with Docbook, and show you how to make CHM and PDF files on Windows.
-->This topic shows how to use the classes in the Open XML SDK 2.5 forOffice to programmatically convert a Microsoft Word 2010 or MicrosoftWord 2013 document that contains VBA code (and has a .docm extension) toa standard document (with a .docx extension). It contains an exampleConvertDOCMtoDOCXBinary fortress multi keygen 1. method to illustrate this task.
To use the sample code in this topic, you must install the Open XML SDK2.5. Youmust explicitly reference the following assemblies in your project:
WindowsBase
DocumentFormat.OpenXml (Installed by the Open XML SDK)
You must also use the following usingdirectives or Imports statements to compilethe code in this topic.
ConvertDOCMtoDOCX Method
The ConvertDOCMtoDOCX sample method can be used to convert a Word2010 or Word 2013 document that contains VBA code (and has a .docmextension) to a standard document (with a .docx extension). Use thismethod to remove the macros and the vbaProject part that contains themfrom a document stored in .docm file format. The method accepts a singleparameter that indicates the file name of the file to convert.
The complete code listing for the method can be found in the Sample Code section.
Convert Docbook To Pdf Windows 2000 Pdf
Calling the Sample Method
To call the sample method, pass a string that contains the name of thefile to convert. The following sample code shows an example.
Parts and the vbaProject Part
A word processing document package such as a file that has a .docx or.docm extension is in fact a .zip file that consists of several parts. You can think of each part as being similarto an external file. A part has a particular content type, and cancontain content equivalent to an external XML file, binary file, imagefile, and so on, depending on the type. The standard that defines howOpen XML documents are stored in .zip files is called the Open PackagingConventions. For more information about the Open Packaging Conventions,see ISO/IEC 29500-2.

When you create and save a VBA macro in a document, Word adds a newbinary part named vbaProject that contains the internal representationof your macro project. The following image from the Document Explorer inthe Open XML SDK 2.5 Productivity Tool for Microsoft Office shows thedocument parts in a sample document that contains a macro. ThevbaProject part is highlighted.
Figure 1. The vbaProject part
The task of converting a macro enabled document to one that is not macroenabled therefore consists largely of removing the vbaProject part fromthe document package.
How the Code Works
The sample code modifies the document that you specify, verifying thatthe document contains a vbaProject part, and deleting the part. Afterthe code deletes the part, it changes the document type internally andrenames the document so that it uses the .docx extension.
The code starts by opening the document by using the Open** method and indicating that thedocument should be open for read/write access (the final trueparameter). The code then retrieves a reference to the Document part byusing the MainDocumentPart** property of the wordprocessing document.
The sample code next verifies that the vbaProject part exists, deletesthe part and saves the document. The code has no effect if the file toconvert does not contain a vbaProject part. To find the part, the samplecode retrieves the VbaProjectPart** property of the document. Itcalls the DeletePart** method to delete the part, andthen calls the Save** method of the document to save thechanges.
It is not enough to delete the part from the document. You must alsoconvert the document type, internally. The Open XML SDK 2.5 provides away to perform this task: You can call the document ChangeDocumentType** method and indicate thenew document type (in this case, supply theWordProcessingDocumentType.Document enumerated value).
You must also rename the file. However, you cannot do that while thefile is open. The using block closes the file at the end of the block.Therefore, you must have some way to indicate to the code after theblock that you have modified the file: The fileChanged Boolean variable tracks this informationfor you.
The code then renames the newly modified document. To do this, the codecreates a new file name by changing the extension; verifies that theoutput file exists and deletes it, and finally moves the file from theold file name to the new file name.
Sample Code
The following is the complete ConvertDOCMtoDOCX code sample in C# and VisualBasic.