Click here to Skip to main content
13,050,904 members (62,666 online)
Rate this:
Please Sign up or sign in to vote.
hello, can u guide how to store rtf file into database,retriving

protected void Button1_Click(object sender, EventArgs e)
   if (FileUpload1.HasFile && FileUpload1.PostedFile != null && FileUpload1.PostedFile.FileName != "")
         HttpPostedFile file = FileUpload1.PostedFile;
public void ConvertDocToRTF(string DocPath)
    //Create object of documnet .
    Document document = new Document();
       //Load doc file from given path
       //Save doc file. It will convert to .Rtf format .
       document.SaveToFile("Tesfile.rtf", FileFormat.Rtf);
    catch (Exception) { throw; }
Posted 19-Feb-12 17:20pm
Updated 19-Feb-12 18:30pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Question is unclear. Do you want to store the file itself, or just the contents?
If you want to store the file you need a LOB[^] type, more specifically a BLOB. An alternative in keeping the file, but not uploading to the database is saving the file in a DMS (document management system) and saving the link to the location.

If you want to save the rtf text you can do so via richtextbox, although I don't know how it will react on complex documents (headers, tables, images, ...).

The link has a sample in ADO.Net, but any other provider will have something similar.

Read it through, if you have more specific questions, update this question with more info.

Hope this helps.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 20 Feb 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100