Link to home
Start Free TrialLog in
Avatar of Ess Kay
Ess KayFlag for United States of America

asked on

.NET Convert .RTF to .DOTX

How to convert .RTF to DOTX in .net
SOLUTION
Avatar of David Johnson, CD
David Johnson, CD
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Ess Kay

ASKER

not working

Im doing this:
It makes DOCX only, i need dotx
DIM dotXLoc as string = "c:/temp/word.docx"
DIM rtfLoc as string = "c:/test/test.rtf"

Dim wordApp As Object = New Microsoft.Office.Interop.Word.Application()
Dim currentDoc As Microsoft.Office.Interop.Word.Document = wordApp.Documents.Open(rtfLoc)
currentDoc.SaveAs(dotXLoc, Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatDocumentDefault)
currentDoc.Close()
wordApp.Quit()

Open in new window



If i change to DOTX extension  
dotXLoc  = "c:/temp/word.DOTX"
, it still saves in docx format, so basically, to open the file, i have to manually change the ext to docx in windows explorer
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Ess Kay

ASKER

Thanks