public static void Run()
{
try
{
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName);
// ExStart:EmbeddedObjectsCreatedInsideApplication
IDictionary<string, string> fileFormatExt = new Dictionary<string, string>();
fileFormatExt.Add("RTF", "_rtfFile_out.rtf");
fileFormatExt.Add("MSWordDoc", "_wordFile_out.docx");
fileFormatExt.Add("ExcelML12", "_excelFile_out.xlsx");
Project project = new Project(dataDir + "Embedded.mpp");
foreach (OleObject oleObject in project.OleObjects)
{
if (!string.IsNullOrEmpty(oleObject.FileFormat) && fileFormatExt.ContainsKey(oleObject.FileFormat))
{
string path = dataDir + "EmbeddedContent_" + fileFormatExt[oleObject.FileFormat];
using (FileStream fileStream = new FileStream(path, FileMode.Create))
fileStream.Write(oleObject.Content, 0, oleObject.Content.Length);
}
}
// ExEnd:EmbeddedObjectsCreatedInsideApplication
}
catch (Exception ex)
{
Console.WriteLine(ex.Message + "\nThis example will only work if you apply a valid Aspose License. You can purchase full license or get 30 day temporary license from http:// Www.aspose.com/purchase/default.aspx.");
}
}
}