Hi Derek,
stream and use the DetectFileFormat method to detect it’s format. These are
both times where you might need extract the file format as it’s not visible
FileStream docStream = File.OpenRead(MyDir + "Document.FileWithoutExtension"); // The file format of this document is actually ".doc"
FileFormatInfo info = FileFormatUtil.DetectFileFormat(docStream);
Console.WriteLine("The document format is: " + FileFormatUtil.LoadFormatToExtension(info.LoadFormat));
Console.WriteLine("Document is encrypted: " + info.IsEncrypted);
Console.WriteLine("Document has a digital
signature: " + info.HasDigitalSignature);
http://www.aspose.com/docs/display/wordsnet/How+to++Detect+the+File+Format
http://www.aspose.com/docs/display/wordsnet/FileFormatInfo+Class
Hi Derek,
PresentationEx pres = new PresentationEx(PresentationStream);SourceFormatEx format = pres.SourceFormat;
Many thanks it would be useful for a product like Aspose.Total to include a single mechanism to detect all file types from a stream. This would also be a differentiator driving decisions to purchase the total product rather than individual products. Can you put this on a “would like to have” list?
Hi Derek,
FileStream inputfile = new FileStream(@“C:\pdftest\New Microsoft PowerPoint
Presentation.pptx”, FileMode.Open);<o:p></o:p>
try
{
Document doc = new Document(inputfile);
Console.WriteLine("Input document is proper PDf");
}
catch (Aspose.Pdf.Exceptions.InvalidPdfFileFormatException ex)
{
Console.WriteLine("Source file is not PDF. " + ex.Message);
}
inputfile.Close();
Besides this, you may consider determining MIME type of file. You may refer to the discussion over this link.
dl129302:Many thanks it would be useful for a product like Aspose.Total to include a single mechanism to detect all file types from a stream. This would also be a differentiator driving decisions to purchase the total product rather than individual products. Can you put this on a "would like to have" list?
The mime type for an excel document is being returned as application/octet-stream. It is correctly recognised by Aspose.Cells. I cannot rely on the mimetype being correct even though the documents were created by the application provider using Aspose.
The mime type for an excel document is being returned as application/octet-stream. It is correctly recognised by Aspose.Words. I cannot rely on the mimetype being correct even though the documents were created by the application provider using Aspose.
PresentationEx is not a type in the Aspose.Slides version I am working with.
Hi,