How to convert .doc files to .docx in a sharepoint library programmatically.

Is there any possibility to Convert .doc files to .docx in a sharepoint document library.
I have thousands and lakhs of .doc files and I need to automate to convert those .doc files to .docx with an automation script or powershell script or doing it programmatically.
Can someone help me get through this.
Thanks
Gayatri

Hello Gayatri,
You can convert files from doc to docx using following options
Option 1 
in bulk using  Office File Converter (OFC) and Version Extraction Tool. Please refer below url for reference - http://technet.microsoft.com/en-us/library/cc179019.aspx
Option 2 - PowerShell
please refer url -http://blogs.msdn.com/b/ericwhite/archive/2008/09/19/bulk-convert-doc-to-docx.aspx
Convert DOC to DOCX using PowerShell
I was tasked with taking a large number of .DOC and .RTF files and converting them to .DOCX. The files were then going to be imported into a SharePoint site. So I went out on the web looking for PowerShell scripts to accomplish this. There are plenty to
choose from.
All the examples on the web were the same with some minor modifications. Most of them followed this pattern:
$word = new-object -comobject word.application
$word.Visible = $False
$saveFormat = [Enum]::Parse([Microsoft.Office.Interop.Word.WdSaveFormat],”wdFormatDocumentDefault”);
#Get the files
$folderpath = “c:\doclocation\*”
$fileType = “*doc”
Get-ChildItem -path $folderpath -include $fileType | foreach-object
$opendoc = $word.documents.open($_.FullName)
$savename = ($_.fullname).substring(0,($_.FullName).lastindexOf(“.”))
$opendoc.saveas([ref]“$savename”, [ref]$saveFormat);
$opendoc.close();
#Clean up
$word.quit()
After trying out several I started to convert some test documents. All went well until the files were uploaded to SharePoint. The .RTF files were fine but even though the .DOC fiels were now .DOCX files they did not allow for all the functionality of .DOCX
to be used.
After investigating a little further it turns out that when doing a conversion from .DOC to .DOCX the files are left in compatibility mode. The files are smaller, but they don’t allow for things like coauthors.
So back to the drawing board and the web and I found a way to set compatibility mode off. The problem was that it required more steps including saving and reopening the files. In order to use this method I had to add a compatibility mode object:
$CompatMode = [Enum]::Parse([Microsoft.Office.Interop.Word.WdCompatibilityMode], “wdWord2010″)
And then change the code inside the {} from above to:
$opendoc = $word.documents.open($_.FullName)
$savename = ($_.fullname).substring(0,($_.FullName).lastindexOf(“.”))
$opendoc.saveas([ref]“$savename”, [ref]$saveFormat);
$opendoc.close();
$converteddoc = get-childitem $savename
$opendoc = $word.documents.open($converteddoc.FullName)$opendoc.SetCompatibilityMode($compatMode);
$opendoc.save()
$opendoc.close()
It worked, but I didn’t like it. So back to the web again and this time I stumbled across the real way to do it. Use the Convert method. No one else seems to have used this in any of the examples but it is a much cleaner way to do it then the compatibility
mode setting. So this is how I changed my code and now all the files come in to SharePoint as true .DOCX files.
$word = new-object -comobject word.application
$word.Visible = $False
$saveFormat = [Enum]::Parse([Microsoft.Office.Interop.Word.WdSaveFormat],”wdFormatDocumentDefault”);
#Get the files
$folderpath = “c:\doclocation\*”
$fileType = “*doc”
Get-ChildItem -path $folderpath -include $fileType | foreach-object
$opendoc = $word.documents.open($_.FullName)
$savename = ($_.fullname).substring(0,($_.FullName).lastindexOf(“.”))
$word.Convert()
$opendoc.saveas([ref]“$savename”, [ref]$saveFormat);
$opendoc.close();
#Clean up
$word.quit()

Similar Messages

  • How to convert Doc file into image

    hello frnds
                     Can any body guide me how to convert doc file into image and show into swf loader.
    actually i have to convert doc files into swf files in runtime so that i have to use this flow.
    is it possible to convert doc file into byte array and than convert into image.
    Thanks And Regards
        Vineet Osho

    You can convert any DisplayObject to byeArray using this function ImageSnapshot.captureBitmapData().getPixels()

  • How to convert .doc file into .rtf file in Java?

    Hello All,
    I want to convert doc file into rtf format in java and for the same i am not getting any help so pls suggest some solution for that.
    Thanks and Regards
    only1Vinay

    MS-Word formats (DOC) are notorious for not being standardized from one version to another, so what ever you get will be version specific. If you must do the conversion, I suggest you do a MS-Script in Word to do it or one of the .Net languages. As stated the Word format from version to version is not standardized.

  • How To convert .doc file to .jpg file

    hello friends,
    can anyone tell me how can we convert a .doc file to .jpg file wid d help of java???????

    Hi,
    I am working on similar requirement. There is a vb code which does it using Document Image Printer and you can then call that code from java class using native calls. I will let you know if we succeed. In case you find something else post it here.

  • How to convert doc files to pdf files

    how do I convert a microsoft doc file into pages and then into a pdf to send out to others?

    Several ways:
    In Word or in Pages, you can Print and choose to "print to PDF" instead of a printer.  This applies to all applications that have the ability to print (I think it is all but I don't have all applications to test that assertion against). It will be like a printout, no embedded links will work.
    In Pages, you can Export or Share as a PDF. In Word you can Save As a PDF. In this method, embedded links should still work.

  • Please inform me how to convert .pdf files to .docx and be able to typed in the converted file.

    help.

    Hi there,
    Welcome!
    Here is a handy 'getting started' guide that may assist you.
    Also - what is happening after you convert the PDF to Word? That way I can help you troubleshoot.
    Looking forward to hearing back from you.
    Kind regards, Stacy

  • How to I delete acrobat software than converts .pdf files to .docx files?

    Hello. How do I delete the Acrobat software that converts .pdf files to .docx files?
    Thank you.
    DL

    Which part of the Acrobat SDK are you using? Which Acrobat product? Is this an enterprise deployment question? Perhaps if you tell us why you want to we can better direct you (or we might just argue of course).

  • How to convert Flat file(.txt) data to an Idoc format(ORDERS05)

    Hi,
    How to convert Flat file(.txt) data to an Idoc format(ORDERS05). If any FM does the same work please let me know.
    thanks in advance,
    Chand
    Moderator message : Duplicate post locked. Read forum rules before posting.
    Edited by: Vinod Kumar on Jul 26, 2011 11:11 AM

    Hi,
            For more information, please check this link.
    http://sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/46759682-0401-0010-1791-bd1972bc0b8a
    Have a look at the FM IDOC_XML_FROM_FILE. May be it helps...
    Regards

  • Converting *.doc files to *.swf files

    I PURCHASED FLASHPAPER 2 SOME YEARS BACK TO CONVERT STATIC
    WINDOWS *.DOC FILES TO *.SWF FILES TO UPLOAD ONTO A WEBSITE. I
    RECENTLY BOUGHT A NEW COMPUTER WITH WINDOWS VISTA. FLASHPAPER 2
    DOES NOT WORK ON VISTA. I WAS INFORMED BY ADOBE THAT FLASH CS3 CAN
    RUN ON VISTA. I WOULD LIKE TO FIND OUT HOW TO CONVERT STATIC *.DOC
    FILES INTO *.SWF FILES ON FLASH CS3.

    you can also try this:
    Step 1. convert .doc file to .pdf
    you can find a free converter here
    http://sourceforge.net/projects/pdfcreator/
    Step 2. convert the .pdf file to .swf
    using PDF2SWF & SWFCombine from
    http://www.swftools.org/

  • I have a subscription for Adobe ExportPDF. I am attempting to convert.pdf files to .docx. I have sig

    I have a subscription for Adobe ExportPDF. I am attempting to convert.pdf files to .docx. I have signed into your site and have selected two small files. The dialogue tells me “exporting 2 files 0% complete” with noo progress for about 45 minutes now. How can I complete this process?

    You need to ask in → http://forums.adobe.com/community/exportpdf

  • I can not open adobe files. mainly ones that end in doc. I purchased the 19.99 to convert .doc files

    I can not open adobe files that end in .doc. I purchased the 19.99 to convert doc to pdf and I still cant open. I get an error reading.

    Hi,
    Which Adobe Service did you purchased?
    If you have purchased CreatePDF please visit: https://createpdf.acrobat.com/SignIn.html
    Sign in with your Adobe ID and password, and then convert your word doc into PDF.
    Please let me know if that works.
    If you have Adobe Reader, you cannot convert .doc file to .PDF by drag and drop.
    ~ Aditya

  • How to convert .class file to exec file...

    hi.
    how to convert .class file to exec file...
    please explain me clearly.....
    thanks...

    Placing your exact "question" into google:
    http://www.google.com/search?q=how+to+convert+.class+file+to+exec+file...

  • I have a MacBook Pro, I want to copy Itunes files to an SD card to play in my car, the SD Card doesn't appear in Itunes when I insert it, and I don't know how to convert the files to the correct format, can anyone help?

    I have a MacBook Pro, I want to copy Itunes files to an SD card to play in my car, the SD Card doesn't appear in Itunes when I insert it, and I don't know how to convert the files to the correct format, can anyone help?
    Thank you

    So it seems from reading the COMMAND manual that my first issue is that I used a 16GB SD card, and the manual says it will only recogize up to a 2GB SD card. I did use my MB Air's SD card slot and crated a folder and dragged the music files to it, then to the card. So I am going to get a 2GB card and try that next. Otherwise just stick with the iPOD connected. At least that is 8GB

  • HOW TO CONVERT PDF FILE IN TO XML FILE?

    HOW TO CONVERT PDF FILE IN TO XML FILE

    No Office programs can open a pdf and edit the contents so you will have to get a different app to convert teh pdf into xls format. There are plenty to be found on the web.
    Rod Gill
    The one and only Project VBA Book
    Rod Gill Project Management

  • How to convert XML file to an internal table ?

    Hi All,
    I want to do a batch input program. The source data would be given as an excel file . I would like to know how to convert XML file to internal table properly. Please help me out..
    Thanking you in advance ..
    Shankara Narayanan T.V

    Hi Shankar,
    use 'ALSM_EXCEL_TO_INTERNAL_TABLE' FM.
      CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
             EXPORTING
                  filename                = p_file1
                  i_begin_col             = '1'
                  i_begin_row             = '5'
                  i_end_col               = '40'
                  i_end_row               = '16'
             TABLES
                  intern                  = it_intern
             EXCEPTIONS
                  inconsistent_parameters = 1
                  upload_ole              = 2
                  OTHERS                  = 3.
        IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
    LOOP AT it_intern.
          AT NEW row.
            CLEAR it_intern.
          ENDAT.
            CASE lv_flag.
        Production Version
              WHEN  1.
                it_master-matnr      =   it_intern-value.     
              WHEN  2.
                it_master-werks      = it_intern-value.
              WHEN  3.
                it_master-verid      = it_intern-value.
              WHEN  4.
                it_master-text1      = it_intern-value.
              WHEN  5.
                it_master-fdate     = it_intern-value.
          AT END OF row.
            APPEND it_master.
          ENDAT.
        ENDLOOP.
    -Anu
    Message was edited by:
            Anupama Reddy

Maybe you are looking for

  • My iPad was Swapped by this Dubious iPad and Now I'm No Longer Angry - I'm Just MISERABLE

    My iPad 3 was bought new at Best Buy when the iPad 3 was new. Unfortunately, rather than going to the Apple store, my well-intentioned daughter bought it from Best Buy, paying for an extended two year warranty. After a year and a half my iPad was lag

  • Problem in formatting of long text -- line break not recognized.

    Hi , We have a PO smartform in our SRM system and we are facing problem with formatting of long text on the smartform for long texts maintained for the PO. for ex, we maintain the long text as -- "this is long text for item 1. 1. this is line 1. 2. t

  • Speakable items help

    this is completely pointless but i think it would be cool. I like to use the speech tools to just talk to my mac and have it open things for me. It would be cool if after doing something I could say "Thank you" and my mac would say "You're welcome".

  • Sharing: Uploading iMovie to Website

    Having trouble trying to put a 3 minute Quicktime movie up on a Website and getting it to run/stream continuously. At the moment it stops every few seconds waiting for buffering. I created the movie from a DVD using MPEG Streamclip 1.8, brought it in

  • Compiling STREAM module for 64-bit kernel

    Hi, I am trying to compile a STREAM module for Solaris. The results I get when I execute "isalist" and "isainfo -kv" are: -"sparcv9+vis sparcv9 sparcv8plus+vis sparcv8plus sparcv8 sparcv8-fsmuld sparcv7 sparc" -"64-bit sparcv9 kernel modules" The hos