Profile Picture

Working with DOCX

Posted By Rob Panosh 2 Months Ago
Author
Message
Rob Panosh
Question Posted 2 Months Ago
View Quick Profile
Forum Newbie

Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)

Group: Forum Members
Last Active: Last Month
Posts: 14, Visits: 31
Hi,
 We would like to store a docx in our database as a string.  Then load back into the RichText control.  We are having trouble.
Here is our public property on our user control to get/set value


It will save to the database but when we try to reassign your control it asks if we would like to save the value.  If I select "Yes" to save the document open blank.  I have saved the value for Me.BusinessObect.Body and attached.





Please advise ... 

Thanks, Rob




Attachments
body.zip (17 views, 303.00 KB)
Rob Panosh
Posted 2 Months Ago
View Quick Profile
Forum Newbie

Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)

Group: Forum Members
Last Active: Last Month
Posts: 14, Visits: 31
Hi,

Haven't heard response?  Any ideas we need to get this sorted out.

Thanks,
Rob

Nevron Support
Posted 2 Months Ago
View Quick Profile
Supreme Being

Supreme Being (3,905 reputation)Supreme Being (3,905 reputation)Supreme Being (3,905 reputation)Supreme Being (3,905 reputation)Supreme Being (3,905 reputation)Supreme Being (3,905 reputation)Supreme Being (3,905 reputation)Supreme Being (3,905 reputation)Supreme Being (3,905 reputation)

Group: Forum Members
Last Active: 1 days ago @ 4:40 AM
Posts: 2,879, Visits: 3,044
Hi Rob,

Apologies for the delayed response, we must have missed the original post.

UTF8 character encoding is not a good way to encode a byte array for database storage roundtrip. It may result in information loss particularly in the area of Unicode surrogate characters (0xD800 to 0xDBFF) as some byte sequences may not be a valid unicode surrogate character sequence. We would recommend you to use base64 character encoding instead as it will not result in information loss. We tested with the following code and it was working properly:

  string docxText = string.Empty;

   private void button1_Click(object sender, EventArgs e)
   {
    {
      MemoryStream stream = new MemoryStream();
      m_TextControl.View.SaveToStream(stream, new Nevron.Nov.Text.Formats.NDocxTextFormat());
   
      docxText = Convert.ToBase64String(stream.ToArray());
    }
   }

   private void button2_Click(object sender, EventArgs e)
   {
    {
      MemoryStream stream = new MemoryStream(Convert.FromBase64String(docxText));
      m_TextControl.View.LoadFromStream(stream, new Nevron.Nov.Text.Formats.NDocxTextFormat());
    }
   }

We hope this helps - let us know if you have any questions or meet any problems.

Best Regards,
Nevron Support Team





Similar Topics


Reading This Topic