Working with DOCX


Author
Message
Rob Panosh
Rob Panosh
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
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 (568 views, 303.00 KB)
Rob Panosh
Rob Panosh
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
Posts: 14, Visits: 31
Hi,

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

Thanks,
Rob
Nevron Support
Nevron Support
Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)
Group: Administrators
Posts: 3.1K, Visits: 4.2K
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


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search