public static void Run() { string filePath = Constants.SAMPLE_VSDX; string imageFilePath = Constants.SAMPLE_EMF; string embeddedFilePath = Constants.SAMPLE_PPTX; string filePathOut = Path.Combine(Constants.GetOutputDirectoryPath(), Constants.SAMPLE_NAME + Path.GetExtension(filePath)); FileStream imageStream = new FileStream(imageFilePath, FileMode.Open); byte[] imageBytes = ExampleHelper.ToBytes(imageStream); imageStream.Close(); OleDiagramOptions oleDiagramOptions = new OleDiagramOptions(embeddedFilePath, imageBytes, 2); oleDiagramOptions.X = 1; oleDiagramOptions.Y = 1; oleDiagramOptions.Width = 2; oleDiagramOptions.Height = 1; using (Merger merger = new Merger(filePath)) { merger.ImportDocument(oleDiagramOptions); merger.Save(filePathOut); } Console.WriteLine("Embedded object was added to the source document successfully."); Console.WriteLine($"Check output {filePathOut}."); }
public static void Run() { string filePath = Constants.SAMPLE_PDF_2; string embeddedFilePath = Constants.SAMPLE_PPTX; string filePathOut = Path.Combine(Constants.GetOutputDirectoryPath(), Constants.SAMPLE_NAME + Path.GetExtension(filePath)); PdfAttachmentOptions olePdfOptions = new PdfAttachmentOptions(embeddedFilePath); using (Merger merger = new Merger(filePath)) { merger.ImportDocument(olePdfOptions); merger.Save(filePathOut); } Console.WriteLine("Embedded object was added to the source document successfully."); Console.WriteLine($"Check output {filePathOut}."); }
public static void Run() { string filePath = Constants.SAMPLE_DOCX; string embeddedFilePath = Constants.SAMPLE_PDF; string filePathOut = Path.Combine(Constants.GetOutputDirectoryPath(), Constants.SAMPLE_NAME + Path.GetExtension(filePath)); int pageNumber = 2; OleWordProcessingOptions oleWordsOptions = new OleWordProcessingOptions(embeddedFilePath, pageNumber); oleWordsOptions.Width = 300; oleWordsOptions.Height = 300; using (Merger merger = new Merger(filePath)) { merger.ImportDocument(oleWordsOptions); merger.Save(filePathOut); } Console.WriteLine("Embedded object was added to the source document page successfully."); Console.WriteLine($"Check output {filePathOut}."); }
public static void Run() { string filePath = Constants.SAMPLE_XLSX; string embeddedFilePath = Constants.SAMPLE_PDF; string filePathOut = Path.Combine(Constants.GetOutputDirectoryPath(), Constants.SAMPLE_NAME + Path.GetExtension(filePath)); int pageNumber = 2; OleSpreadsheetOptions oleCellsOptions = new OleSpreadsheetOptions(embeddedFilePath, pageNumber); oleCellsOptions.RowIndex = 2; oleCellsOptions.ColumnIndex = 2; using (Merger merger = new Merger(filePath)) { merger.ImportDocument(oleCellsOptions); merger.Save(filePathOut); } Console.WriteLine("Embedded object was added to the source document page successfully."); Console.WriteLine($"Check output {filePathOut}."); }