Hi,
I have the same problem and I need to feedback quickly my Customer about that.
Lorenzo
Hi,
I have the same problem and I need to feedback quickly my Customer about that.
Lorenzo
Tanks,
Just an other problem, I need to get document (word and powerpoint) from a Web Application and join all the document. I have a problem opening a ppt document from the Stream. I you look the code, I use the same stream for word and PowerPoint, for Word works but for PowerPoint there is an error: “Unable to read entire block; 110 bytes read; expected 512 bytes”.
Lorenzo
public Stream GetFromHttp(String docUrl)
{
Stream outStream = new MemoryStream();
byte[] buffer = new byte[4096];
WebRequest wr = WebRequest.Create(docUrl);
MemoryStream ms = new MemoryStream();
WebResponse response = wr.GetResponse();
using (Stream responseStream = response.GetResponseStream())
{
int count = 0;
do
{
count = responseStream.Read(buffer, 0, buffer.Length);
ms.Write(buffer, 0, count);
} while (count != 0);
}
ms.Seek(0, SeekOrigin.Begin);
//word
if (response.ContentType.IndexOf("word") != -1)
{
Document wordDoc = new Document(ms);
wordDoc.Save(outStream, Aspose.Word.SaveFormat.FormatAsposePdf);
}
//powerpoint
if (response.ContentType.IndexOf("powerpoint") != -1)
{
Aspose.PowerPoint.Presentation pppDoc = new Aspose.PowerPoint.Presentation(ms);
int i = 0;
foreach (Slide slide in pppDoc.Slides)
{
System.Drawing.Image img = slide.GetThumbnail(1, 1);
//todo new word document with pptThumbnail
}
}
//pdf
if (response.ContentType == "application/pdf")
{
Aspose.Pdf.Kit.PdfFileEditor pdfDoc = new PdfFileEditor();
//TODO ??
}
response.Close();
return outStream;
}
Dear Lorenzo,
Error “Unable to read…” can be only in 2 situations.
1. You try to read not PowerPoint document.
2. Presentation is broken.