Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.

Mon Jan 13, 2020 9:30 am

Hello,
is there a possibility to convert a RTF document to a .doc or docx document by using Spire Doc?

Thanks a lot in advance

Maikel

MaikelFra
 
Posts: 5
Joined: Thu Jan 09, 2020 12:18 pm

Mon Jan 13, 2020 9:56 am

Hi Maikel,

Thanks for your inquiry.
Our Spire.Doc supports converting RTF to .Doc or .Docx. Please refer to following code:
Code: Select all
            Document document = new Document(filePath + @"your sample.rtf");
            document.SaveToFile("20195.docx", FileFormat.Docx);
            //document.SaveToFile("20195.doc", FileFormat.Doc);

If you encounter issues, please provide detailed information along with the input RTF file.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Mon Jan 13, 2020 12:01 pm

Hi, thanks a lot for your feedback.
Unfortunately I am facing an issue.
By using ""E:/DataSources/Paschmann/RTF_Export/RTF/" + @"test.rtf" as Source Path, I am getting the message: Inputstring has the wrong format. By using "test.doc" I am getting no issue.

Is it needed to set an reference in addition to the existing below: ?
---------------------
using Spire.Doc;
using Spire.Doc.Documents;
--------------------

Please see code below:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

using Spire.Doc;
using Spire.Doc.Documents;

namespace WindowsFormsApplication2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
Document document = new Document("E:/DataSources/Paschmann/RTF_Export/RTF/" + @"test.rtf");
//document.SaveToFile("20195.docx", FileFormat.Docx);

}
}
}

MaikelFra
 
Posts: 5
Joined: Thu Jan 09, 2020 12:18 pm

Tue Jan 14, 2020 1:46 am

Hi Maikel,

Thanks for your information.
It seems the issue is related to your RTF file. Please provide the RTF file for further investigation.

Thanks,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Mon Jan 20, 2020 8:14 am

Hi,

Hope you are doing well.
Has your issue been resolved? If not, please provide your RTF file for further investigation.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Return to Spire.Doc

cron