Skip to content

Instantly share code, notes, and snippets.

@GroupDocsGists
Last active October 10, 2020 07:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GroupDocsGists/3ebe23286748c319a6b5429b1bda9696 to your computer and use it in GitHub Desktop.
Save GroupDocsGists/3ebe23286748c319a6b5429b1bda9696 to your computer and use it in GitHub Desktop.
Embed Document into Excel Spreadsheet as OLE Object in Java
// Embed Word Document into an Excel Spreadsheet as an OLE object
int pageNumber = 1;
OleSpreadsheetOptions oleCellsOptions = new OleSpreadsheetOptions("document.docx", pageNumber);
oleCellsOptions.setRowIndex(2); // Set row & column number of Spreasheet to embedded document
oleCellsOptions.setColumnIndex(1);
// Import the Word document into Spreadsheet
Merger merger = new Merger("spreadsheet.xlsx"); // Source Spreadsheet
merger.importDocument(oleCellsOptions);
merger.save("output-spreadsheet.xlsx");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment