What format of StiReport.SavePackedDocumentString?

Stimulsoft Reports.NET discussion
Post Reply
Hoang Nguyen
Posts: 11
Joined: Wed Jun 15, 2011 10:19 pm
Location: VN

What format of StiReport.SavePackedDocumentString?

Post by Hoang Nguyen »

Hi,
After Reder report, StiReport support some method: SaveDocument(SaveDocumentString), SavePackedDocument(SavePackedDocumentString). SaveDocument return file or String with XML format. SavePackedDocumentString return smaller string and SavePackedDocument (to file) return file with smaller size (seem to be binary format because I don't see any character).
I wonder what format SavePackedDocumentString use and can StiViewer for Silverlight can use this string to show report?
Thanks
Ivan
Posts: 960
Joined: Thu Aug 10, 2006 1:37 am

What format of StiReport.SavePackedDocumentString?

Post by Ivan »

Hello,

The SaveDocumentToString method save document to xml and then convert to the Base64 string.
The SavePackedDocumentToString method save document to xml, pack it to gzip format and then convert to the Base64 string.
Unfortunately, Silverlight do not support the gzip compression, so LoadPackedDocumentFromString method is not supported in the StiViewerSL.

Thank you.
Hoang Nguyen
Posts: 11
Joined: Wed Jun 15, 2011 10:19 pm
Location: VN

What format of StiReport.SavePackedDocumentString?

Post by Hoang Nguyen »

Hi Ivan,
Silverlight support Gzip input/output stream to compress/decompress. Could you provide this feature in next release?
Andrew
Posts: 4108
Joined: Fri Jun 09, 2006 3:58 am

What format of StiReport.SavePackedDocumentString?

Post by Andrew »

Hello,

Silverlight do not contain the System.IO.Compression namespace.
If you know how to realize the gzip compression by means of Silverlight, please send us a sample.

Thank you.
Hoang Nguyen
Posts: 11
Joined: Wed Jun 15, 2011 10:19 pm
Location: VN

What format of StiReport.SavePackedDocumentString?

Post by Hoang Nguyen »

Hi Andrew,
I found in your assembly Stimulsoft.Compression.SL.dll contain System.IO.Compression namespace. This is my sample to Decompress String in SL by your GZipInputStream:

private string DecompressString(string strXMl)
{
Byte[] oData = Convert.FromBase64String(strXMl);
MemoryStream mem = new MemoryStream(oData);
GZipInputStream streamGzip = new GZipInputStream(mem);
MemoryStream memOut = new MemoryStream();
streamGzip.Flush();
streamGzip.CopyTo(memOut);
memOut.Flush();
string strResult = string.Empty;
oData = memOut.ToArray();
//strResult = System.Text.UTF8Encoding.UTF8.GetString(oData, 0, oData.Length); //Convert.ToBase64String(oData);
strResult = Convert.ToBase64String(oData);
memOut.Close();
mem.Close();
streamGzip.Close();

return strResult;
}

I can decompress string return by SavePackedDocumentToString method but I don't know format in order to load report from decompressed string in SL. Could you provide sample and feature LoadPackedDocumentFromString in SL version in next release?
Thanks
Andrew
Posts: 4108
Joined: Fri Jun 09, 2006 3:58 am

What format of StiReport.SavePackedDocumentString?

Post by Andrew »

Hello,

Stimulsoft.Compression.SL.dll is a third-party library, which was adapted to suit our needs. Its compression algorithm is working correctly (used in exports). But the decompression algorithm sometimes does not work correctly for files compressed with built-in methods of .Net Framework. Therefore, we cannot use this library for decompressing of compressed report files, since we cannot guarantee its correct work for all files.

Thank you.
Post Reply