Save a doc/docx file as dotx

In C++/MFC using MS word controller (and not Open xml) how to Save a doc/docx file as dotx??
I am opening the .doc/docxx file, and saving it as .dotx. It saves, but if tried to open when double clicking it, it is says something which means, incorrect file format. Is there a way around?
STDMETHODIMP WordClass::OpenDocument2(BSTR templateFilepath, VARIANT_BOOL readOnly, VARIANT_BOOL visible)
    try
        // Make sure we have a valid MSWordApp object.
        if(m_pWordApp == NULL)
        // Make sure a document is not already open.
        if(m_pWordDoc != NULL)
        CComVariant varFilenameOpen(templateFilepath);
        m_pWordDoc = m_pWordApp->Documents->Add(&varFilenameOpen,
                                   &vtMissing,
                                    &vtMissing,
                                    &vtMissing);
        // Setup the event source sinks so that we will receive sink messages from MSWord.
        DocumentSink::DispEventAdvise(m_pWordDoc);
        if (readOnly == VARIANT_TRUE)
            CComVariant password((long)GetTickCount());
            password.ChangeType(VT_BSTR);
            m_pWordDoc->Protect(MSWORD::wdAllowOnlyComments,    //enum WdProtectionType
                                &vtMissing,                      
 // NoReset.
                                &password);                      
 // Password.
    catch(_com_error &err)
    return(S_OK);
STDMETHODIMP CMSWordController::SaveDocumentAs(BSTR newDocumentFilename)
    try
        // Make sure we have a valid MSWordApp object.
        if(m_pWordApp == NULL)
        // Make sure a document is open.
        if(m_pWordDoc == NULL)
        // Wrap the arguments into Variants.
        CComVariant varFilename(newDocumentFilename);
        // Save the document.
        m_pWordDoc->SaveAs(    &varFilename,        // New Filename
                            &vtMissing,            // Document Format
                            &vtMissing,            // LockComments
                            &vtMissing,            // Password
                            &m_CovFalse,        // AddToRecentFiles
                            &vtMissing,            // WritePassword
                            &vtMissing,            // ReadOnlyRecommended
                            &vtMissing,            // EmbedTrueTypeFonts
                            &vtMissing,            // SaveNativePictureFormat
                            &vtMissing,            // SaveFormsData
                            &vtMissing);        // SaveAsAOCELetter
    catch(_com_error &err)
    return(S_OK);
I called OpenDocument2(...) and then SaveDocumentAs(...).
        

This is the code I am using...
// Wrap the arguments into Variants.
CComVariant varFilename(newDocumentFilename);
// "C:\\abc.dotx" CComVariant varFormat(MSWORD::WdSaveFormat::wdFormatTemplate);
// Save the document.
m_pWordDoc->SaveAs2( &varFilename, // New Filename
&varFormat, // Document Format
&vtMissing, // LockComments
&vtMissing, // Password
&m_CovFalse, // AddToRecentFiles
&vtMissing, // WritePassword
&vtMissing, // ReadOnlyRecommended
&vtMissing, // EmbedTrueTypeFonts
&vtMissing, // SaveNativePictureFormat
&vtMissing, // SaveFormsData
&vtMissing, // SaveAsAOCELetter
&vtMissing, // Encoding
&vtMissing, // INsertLineBreaks
&vtMissing, // AllowSubstitutions
&vtMissing, // LineEnding
&vtMissing, // AddBiDiMarks
&vtMissing); // CompatibilityMode
I am getting an exception, Incompatible File type and File extension.

Similar Messages

  • Cannot use Word2008 doc/docx file to Create PDF (single or multiple)

    Attempting to Create PDF from File >> Single file or Multiple File>> selection of MS-Word2008 .docx or 97-compatible .doc file will error out.
    Adobe has replicated the problem of receiving the same exact error message with Word2008(mac) doc/docx file as input for Acrobat Pro
    fessional 9 to Create PDF. Possible cause is the absence of PDFMaker for Ver9.
    No solution exists.
    Due to resident PDF functionalities of OSX Snow Leopard built into Preview and Print, Acrobat Professional 9 is
    a redundant product for all MacOSX Snow Leopard computers. Only useful functionaity of Acrobat is Create Portfolio and possibly Reduce File Size.
    The non-Universal Automator allows for the creation of PDF through PDF drop down menu available from Word>>Print Dialog which allows for Acrobat PDF option to choose Press/High-Quality/Smallest-File/Standard that can be modified through Distiller.
    Conclusion: Acrobat Professional 9 for MacOSX Snow Leopard as a stand-alone product is Obsolete - Dead on Arrival (DOA). Still useful when used in conjunction with bundled CS4 Suites.

    There is much Acrobat can do once the PDF create created.
    Go to Print Menu and save as Postscript file then drop on Acrobat.

  • I lost a .docx word file , then i found it as a .asd file in the office recovery folder , but i cannot save it as a docx, when i save as a docx file or any other format i cannot find it in the destination folder and

    i lost a .docx word file , then i found it as a .asd file in the office recovery folder , but i cannot save it as a docx, when i save as a docx file or any other format i cannot find it in the destination folder

    No, I already tried looking at that. The file that recovered was not in the trash, it appeared in my documents folder. I opened it up and inside was an iText Express document with coding. Then inside of there, was and then and this "SoftwareMap" document contained a bunch of coding and symbols and words.

  • Pages App only displays first page of MS Word .doc & .docx files

    Hello all,
    There may be a thread out there to address this, but I couldn't find it. 
    I'm trying to switch to the Pages App from Microsoft Word.  All of my .doc & .docx files only display the first page's text.  Any proceeding pages show up blank.  When I show pages side by side it looks as if the second page's info is there, but shifted to the side (half off the page) and I can't seem to move them to the proper place so I can see all my work.
    Anyone have any ideas what the problem is?  I'd like to get as far away from Microsoft as possible. 
    Thanks!

    Folly,
    There's a bug in the Pages adaptation to the Retina Display that causes that problem, and it's not just with imported documents, but all Pages documents according to what I have read here. Search these discussions for more detail. For now, choose "Open in low resolution" in the info pane for the Pages file.
    Jerry

  • PDF maker won't combine doc docx files

    Hello, I can no longer combine Office type files, specifically .doc or .docx files in the pdf builder.  It will only accept pdf files when combining multiple files to build a single pdf file.  I know this used to work (at least on my PC).  I also am aware that I can save them as pdf in Word and then combine but that takes much longer and is a work around for a pretty basic function that I can't get to work.  I've searched this forum and have yet to find a resolution for this problem.  Any suggestions would be greatly appreciated.  Running Mac OS 10.8.2 and Acrobat X.  Office 2011.  Thanks.

    The key here is : I know this used to work (at least on my PC)
    Never worked on a Mac.

  • Viewing .doc/.docx files on new iMac

    Hello folks,
    I have a new iMac running 10.9.4. I don't seem to be able to open .doc or .docx files in either  the new Pages (5.2) or Pages '09, which I've installed. Pages '09 can view both file types quite happily on my old iMac (10.7.5) so I'm a bit mystified.
    Can anybody help? Not being able to open these files is a real problem ...
    thanks in advance.

    Are these Word documents native to your new iMac filesystem, or are they resting on a Google, Dropbox, or other attached storage solution?
    What error message is generated when you attempt to open a random Word document in Pages v5.2? Pages ’09? Preview? TextEdit? Do any of these applications just hang attempting to open the Word document?
    What other applications that may open Word documents have you installed, if any?
    If you single-click to select a random Word document, then press the Spacebar, what default application does Quick Look offer to use?

  • Can not open doc,docx, and Xls files, on server 2008, office 2010,

    on small Business 2008 server, there is office 2010,
    open doc, docx file  i got file conversion massage,
    so i cannot open any Word and Excel file

    Could you open those Office file on another machine? If no, repair you source file first.
    Do you install any other application in this SBS 2008 server, like it also is a DC role?
    Repair/reinstall Office from Control panel to check the result as well.
    Tony Chen
    TechNet Community Support

  • Exporting to doc/docx format.

    Firstly, I've submitted the following to Apple as Pages feedback, however they will not feedback to me an explanation for the observations below, so I'm submitting this because someone else may have an explanation and confirmation.
    Under Mavericks and Pages 5.0.1, Apple have made it harder to convert to doc/docx, since now you have to export to other formats, but when I do export a pages document to doc/docx format then the file size of the doc/docx documents are far smaller than in the pages format. For example, I have a pages document that is 332kb, and when I export it to doc/docx, those documents have sizes 19/12 kb. You might say that the pages document has macros, formatting information, etc, that the doc/docx forms don't, but the content looks the same, and when I re-save the doc/docx documents in pages format, they're both saved as 332kb documents.
    Also, when displaying in doc/docx form, the filename displayed at the very top of the document in the title space has a .pages suffix instead of a .doc/.docx suffix - ok, they're pages documents compatible with Word formatting, but their name in Finder has the .doc/.docx suffix so it should be kept when displayed in the title space of the displayed document. The latter may be a bug, but the following is certainly a bug. The doc/docx documents I've been referring to have had the year 2013 as part of their filename - when these filenames are displayed in the title, the year is being treated as a formatted number, hence the 2013 is being displayed as 2,013 - I emphasise that this does not happen when the pages form of the document is displayed.

    Dear fruhulda and Peter,
         Thanks for replying.
          fruhulda - your reply about the size would imply either that Pages carries with it a lot more features (and thus code) than Word, or that the coding of Pages is, in some way, less efficient than Word - and I don't think either of those is true. The discrepancy in file size is inexplicable, and I've found an article from which this quote opines the same: "That's right: the only way to handle documents in Pages is by saving your working documents as .pages files – which are, inexplicably, often 10 or more times larger than their Word .DOC equivalent – and then exporting .DOC versions as and when you need them." (http://www.zdnet.com/why-i-may-never-install-office-for-mac-again-7000023520/).  In fact, how does Apple get Pages not only to read and write Word files but also PDF files? I can only imagine that Apple have bought use of the relevant routines from Microsoft and Adobe, but the latter both keep a tight rein on their proprietary products. For instance, Office for Mac has, presumably, been developed by Microsoft since I can't find it for sale in the Apple Store. Hence, you may be right that Pages only saves documents in its own format, and documents in other formats call upon routines external to Pages. Regarding the suffix or extension being part of the filename, there's no reason for not including it as part of the file name since, for instance, X.doc is only distinguishable from X.docx by the suffix; and, for instance, http://en.wikipedia.org/wiki/8.3_filename includes the suffix when referring to the filename.
         Peter - first, thanks for the key combination, abling you to do something useful that I didn't know; and following are the results of that tip. The first image is the display of name of the .docx file in the title space of the document:
    When I then click on the triangle, or if I save the document, I get the following:

  • Pages and .doc/.docx

    I recently purchased Pages with the understanding that it would be able to open .doc/.docx files. I downloaded U-0090-01_P.doc from http://www.avery.com/avery/enus/Templates-%26-Software/Templates/Blank-Templates/Labels/Mailing/Shipping-Labe l-10-per-sheetMicrosoft-Word.htm?N=4294967205&refchannel=93551b34dcf4a110VgnVCM1000002118140aR CRD . When I open U-0090-01_P.doc with WORD it is a one page document. When I open it with Pages it is a two page document. Can anyone help me understand this? Thanks, Gary

    I gather the text at the bottom has spilled over?
    There is a discrepancy with how Microsoft measures the distance between lines of type, this may have caused it to just run a little long.
    If that is the case, select all and reduce the line spacing slightly to bring the text back onto 1 page.

  • Problem with Microsoft Word docx files

    Hi All,
    I am able to attach both word(doc, docx) and excel(xls, xlsx) in portal through a BSP application. When i try to display the attached documents, xls & xlsx are working fine, but the problem is with the doc & docx files. It opens a popup and the message is unknown file type. Please find more details below. Can anyone please let me know why this error is coming?
    MIME Type: application/x-zip-compressed
    Description: UnKnown
    Windows does not recognize this MIME type.
    Thanks,
    Anurag

    I am a basis admin so i am not sure how to replecate your problem
    Please check Note 1077464 - Enable TREX search for MS Office 2007 documents if this helps
    1. Maintain the following mime-types for MS Office 2007 on the Portal and R/3 side:
                  Word (ext = .docx)
                  application/vnd. openxmlformats-officedocument.wordprocessingml.document
                  Powerpoint (ext = .pptx)
                  application/vnd. openxmlformats-officedocument.presentationml.presentation
                  Excel (ext = .xlsx)
                  application/vnd. openxmlformats-officedocument.spreadsheetml.sheet
    Samrat

  • How to make a stationery out of .doc or .docx file?

    Hi,
    I stumbled upon a website that has some nice stationery, in .doc format. and since there few free pre made stationery available for Mail.app, at least to my knowledge, because I think I almost downloaded every free stationery available out there that could be easily found via Google. I decided to download some of these .doc stationeries and try to put them in Mail.app, but first I had to convert them into .html format. so here is what I've already tried and did not work:
    first I tried opening them in TextEdit, which supports .doc out of the box, only to find out that the pictures in the documents are gone to thin air. I tried saving it and then opening it with something else like Open Office, but the pictures were permanently gone.
    then I tried opening the original documents directly in Open Office, you guessed right If you said they will look screwed, and they were, and tried to save them as html, they were screwed even more.
    so I did a bit of research and found out that I could use Google Docs in order to convert the documents, I uploaded them into my Google docs and then tried to open them with it, but found it that Google docs can't handle the pictures (specially background pictures) either. as a result I did more searching to find a document converter and here is what I found:
    I found a few online service to convert these documents:
    http://www.freefileconvert.com/ was pretty good to convert the files into an .odt format. at first I thought yes I got the solution, now I can simply convert it to html using Open Office, but unfortunately, when I saved the document in html format and checked it in Safari to see how does it look, as If I would have done the same in MS Office with the original format, it looked pretty much screwed .
    So I continued to look and I found a few other online services one of them asked me to pay a fee, I skipped to the other one which was http://docx-converter.com/. unfortunately the website wasn't functioning properly I think, at least for me (maybe someone out there has succeeded using it, I don't know.) and it didn't send me anything.
    Finally I found http://www.zamzar.com/ that could convert .doc or .docx documents into html, or at least that is what it claims to do so, I tried it, and after I received the file via email, I found out it only contains a bmp image of the document's background. So much for the online conversion services!
    But I decided I would give it a last shot using MS Office online, so I opened up my old Windows Live mail and went into my Skydrive, I uploaded the documents and tried saving it as html, but there were no save as html (after all an online copy of MS Office should have some limitations, otherwise few people will be willing to buy a Desktop version) but this didn't made me disappointed, since I already knew, that Neither Office Word can make a clear conversion, so I tried something different, while I was in Safari looking at the document in online MS office, I saved the page as Web Archives, then I opened the file with TextEdit, and after deleting useless links and pictures, I finally managed to get a clear document with everything that supposed to be in it. At this point I only need to know how to make use of this document to create a stationery with this raw file which is in Web Archive format. any ideas?
    null

    I'm a total idiot! How did I overlook http://www.zamzar.com/ functions? I think I might have mistakenly chosen convert to BMP instead of html. I tried it and the result was very good.
    OK I finally found a good solution for this problem, so everyone out there that has the same problem, here is what I did:
    1. OK if you have some .doc and .docx file formats and you want to convert them into something like .html or .odt, without having to reedit the code or getting a screwed document, use http://www.freefileconvert.com/ in order to convert them into .odt so they would look as they do in MS office just go to the website and upload your documents then choose .odt, then click convert, after a few moments you will get a link to download your .odt files. you can use and play around with your document in Open Office, I have tested it and it's really good.
    2. Or if you want to convert them into .html with a clean code, and all the elements in it, simply go to http://www.zamzar.com/ and then ulpoad your documents, choose .html and enter your email address, you will have your .html files zipped and sent right in your inbox, then you could use Kompozer like me, or any other html editor, to make a template out of it. I tried it and the result was nice, now I have a bunch of nice html files that I can use to make templates and email stationery.

  • I create a document in pages and then export it as doc or docx file. I then email or place the file in a drop box. When another computer opens the doc or docx the photos in the document are randomly scattered. What is the solution?

    I create a document in pages with photos. I then save it and I also export it as a doc or docx file. I then email or place in a drop box the doc or docx file. The other computer opens the file in Microsoft word and the text remains in place but the photos are randomly scattered throughout the document. What is going wrong? How do I correct this problem? I really don't want to go back to a Microsoft machine.

    That assumes two things:
    1. That Apple would have let Microsoft have access to its file format.
    2. That Microsoft would want to spend the time and trouble to write filters for file formats that Apple can't be bothered doing for its own software.
    Peter

  • Post Lion/Unable to open .doc or .docx files from MS Word!!  Ideas??

    In Snow Leopard Pages (iWork '09) version 4 worked fine opening existing .doc and .docx files.  Recently installed Lion and tonight needed to open a Word document.  No joy.  I can open as a PREVIEW but not as an editable Pages document.  As a work-around, I can copy/paste PREVIEW to a new Pages document, edit and save as Word to ship back to fellow collaborator.  VERY UNFRIENDLY "feature"!!!!!

    A Google search using the terms <document "could not be opened" iwork"> turns up two possible solutions:
    Pages '09 refuses to create/open existing doc after Lion upgrade
    Re: The document “navidad.numbers” could not be opened.
    The first discussion's solution is to delete/reinstall/update iWork. The second is to edit the underlying code within the document and remove any Unicode characters.
    I recommend you go with solution no. 1. Use Yvan Koenig's script to delete iWork completely (see below), then reinstall and update iWork before attempting to open a Word document. Then let us know how you went.
    Go to https://public.me.com/koenigyvan
    Choose For iWork > iWork '09 > uninstall iWork '09.zip
    Download Uninstall iWork '09.zip, decompress it, open it in AppleScript Editor and click the Run button

  • How can save/convert a preview file into a Microsoft Word/.doc file?

    Basically, I've open some email attachments and they've opened in 'preview'
    I have tried to save them as a .doc file so that I can open them in Microsoft Word, but have been unable to do this.
    I have tried 'save as...' but it doesn't come up with a .doc option
    I have also tried the 'Open with' in the get info pop up, and have changed it to microsoft word but when I then try to open it, it comes up with a 'Convert File' box.
    I have tried some of the options available but none of them work
    Am I missing something? or am I going down the wrong route?
    Is it even possible to do?
    I'm not great at computers and so answers with obvious steps would be great!
    Thanks!

    Are these PDF files that you're attempting to save a .doc (or .docx) files. Preview won't do it. You can use a number of third-party application to accomplish what you want, but none of them are that inexpensive.
    The least expensive application may be PDFpen - you can save Word documents from PDF files with it, amongst other things.
    Good luck,
    Clinton

  • When opening DOCX files the filename is appended with .DOC extension and fail to open in Word

    When trying to open DOCX files Firefox appends a ".DOC" to the end of them and then Word fails to open them saying "Word cannot start the converter mswrd632.wpc" (using Office 2003 with the Office 2007 Compatibility Pack) - however if I SAVE the file first it saves fine as a DOCX and opens fine in Word.
    Any ideas please?

    What's happening here is that Firefox sees the mime type for the application (application/msword) and identifies it as a Word document. However, FF doesn't recognize the new(ish) docx extentions, and appends the .doc .
    Now, when FF hands the file off to Word for Word to open, Word only looks at the extension (.doc) and tries to open the file as if it were of the older format.
    I don't experience this problem myself with the default settings after installation, I'm going to assume that something's been tweaked in your FF installation. I would recommend checking your settings in Tools > Options > Applications

Maybe you are looking for