5
In my application, I receive a array of bytes file XML. With it I create a stream, but when I try to load it and insert it into XRRichText
, nothing happens. However, the stream on a user’s computer disk file, when loading the file and inserting the contents into the component, it works perfectly. Even so, I need it to be uploaded through the stream, not from a file.
The code below works, but I can’t use it because of creating files on the user’s computer:
RichEditDocumentServer server = new RichEditDocumentServer();
using (Stream file = File.OpenWrite(@"C:\temp\intro.xml"))
{
file.Write(pDados.ByteXML, 0, pDados.ByteXML.Length);
}
server.LoadDocument(@"C:\temp\intro.xml");
...
XRRichText x = (XRRichText)xrCont;
x.Rtf = server.RtfText;
The code below does not work, but it is how I need to do, through the stream, without creating files:
RichEditDocumentServer server = new RichEditDocumentServer();
MemoryStream stream = new MemoryStream();
stream.Write(pDados.ByteXML, 0, pDados.ByteXML.Length);
stream.Flush();
stream.Position = 0;
server.LoadDocument(stream, DocumentFormat.OpenXml);
...
XRRichText x = (XRRichText)xrCont;
x.Rtf = server.RtfText;
from what I understand, you load the xml in
RichEditDocumentServer
and then takes his RTF to playXRRichText
... right ?– Rovann Linhalis
Yes, @Rovannlinhalis, but I imagine that has nothing to do with the problem, since it works when I upload the file. The problem is time to load the stream...
– user75204