Profile Picture

Working with DOCX

Posted By Rob Panosh 4 Years Ago
Author
Message
Rob Panosh
Question Posted 4 Years 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: 4 Years Ago
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 (422 views, 303.00 KB)
Rob Panosh
Posted 4 Years 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: 4 Years Ago
Posts: 14, Visits: 31
Hi,

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

Thanks,
Rob

Nevron Support
Posted 4 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Last Week
Posts: 3,054, Visits: 4,009
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