GdPicture.NET is a Nutrient product. Learn more

DOC to DOCX Conversion with GdPictureDocumentConverter

Table of contents

    DOC to DOCX Conversion with GdPictureDocumentConverter

    Microsoft Office Word

    Even if many people are complaining(opens in a new tab) about Microsoft Office and are looking for (online) alternatives, in 2017, there were 1.2 billion(opens in a new tab) (88 percent of the market share) users worldwide using Word, especially professionals.

    The Microsoft proprietary DOC format was the default format used – and only supported – by Microsoft Word from 1997 to 2003.

    The pressure of government agencies and the open-source world pushed Microsoft to open up its Office formats in the early 2000s. Word, Excel, and PowerPoint documents became .docx, .xlsx, and .pptx, the "X" being for XML.By 2007, the DOCX file format became part of Office 2007, and it is now the de facto standard for text documents.

    However, despite this new standard, the DOC file format is still widely used worldwide: think about all those .doc files archived by companies of all industries!

    Binary file format and OpenXML

    A DOC document is a non-text file containing all the information related to text formatting and other relevant data. A DOCX file is a zip with all the XML files associated with the document, thus producing smaller, lighter files that are easier to read and transfer than DOC. Image support is also more reliable with a better display and higher fidelity. It is also less sensitive to file corruption and viruses.

    The DOC file format’s proprietary nature makes it difficult for external software solutions to support it in their applications. The open nature of the accurately named Office Open XML standard means that it can be read by any word processor, including online tools like Google Docs.

    The GdPicture.NET Document Converter

    The GdPicture.NET SDK includes the GdPictureDocumentConverter class, which provides many different methods and properties for document conversion of 100+ document/image formats(opens in a new tab).

    This class also provides methods to manage parameters like font, margin, page range, or image quality.

    Now, let’s see how to convert a .doc to a .docx file in two steps:

    C# GdPictureStatus status; using (GdPictureDocumentConverter gdpictureDocumentConverter = new GdPictureDocumentConverter()) { status = gdpictureDocumentConverter.LoadFromFile("input.doc"); if (status == GdPictureStatus.OK) { status = gdpictureDocumentConverter.SaveAsDOCX("output.docx"); if (status == GdPictureStatus.OK) { System.Windows.MessageBox.Show("The file has been saved successfully.", "GdPicture"); } else { System.Windows.MessageBox.Show("The file has failed to save. Status: " + status.ToString(), "GdPicture"); } }
    else { System.Windows.MessageBox.Show("The file has failed to load. Status: " + status.ToString(), "GdPicture"); } }

    Do not forget to use the GdPictureStatus class to have a following of your process and get potential errors.

    GdPictureDocumentConverter provides two ways of saving your document as a DOCX:

    • as a string, which is the destination file path
    • using a Stream object, to write the document data onto.

    You can also change properties.For example, you can change the image quality in your DOCX output document like this:

    gdpictureDocumentConverter.DocxImageQuality = 100;

    You will find here all the properties here(opens in a new tab).

    If you wish to learn more about the GdPicture.NET Document Converter, you will find everything you need in our documentation(opens in a new tab).

    Cheers!

    Jonathan D. Rhyne

    Jonathan D. Rhyne

    Co-Founder and CEO

    Jonathan joined PSPDFKit in 2014. As Co-founder and CEO, Jonathan defines the company’s vision and strategic goals, bolsters the team culture, and steers product direction. When he’s not working, he enjoys being a dad, photography, and soccer.

    Explore related topics

    FREE TRIAL Ready to get started?