Merging of PPTX InputStream into Single File

Hi Team,

We have InputStream consists of multiple pptx file.

Our requirement is to convert the above InputStream to a single file (I dont want to store this file to local copy)

Please provide us with the solution


Hi Kranthi,

I am not able to understand your query properly. Could you please share some details (or sample code you have) to explain the issue. It will help us in assisting you properly.

Thanks & Regards,

Simple I have to merge multiple pptx files. The input will be InputStream

Hi Kranthi,

Aspose.Slides provides the feature to Clone the slides between presentations which can be used to merge the presentations. You can check the details from the following documentation link.

Cloning Slides in PresentationEx

Please try the following sample code to merge the two presentation files passed as input streams.

//Files to be used for merging
File file1 = new File("C:/data/HelloWorld.pptx");
File file2 = new File("C:/data/input.pptx");

//Opening files using input stream
FileInputStream input1 = new FileInputStream(file1);
FileInputStream input2 = new FileInputStream(file2);

//Instantiate PresentationEx class to load the source PPTX file
PresentationEx srcPres = new PresentationEx(input1);

//Instantiate PresentationEx class for destination PPTX (where slide is to be cloned)
PresentationEx destPres = new PresentationEx(input2);

//Clone the slides from the source PPTX to the destination PPTX
SlideExCollection slds = destPres.getSlides();

for (int i = 0; i <= srcPres.getSlides().getCount() - 1; i++) {
    slds.insertClone(destPres.getSlides().getCount(), srcPres.getSlides().get_Item(i));

//Write the destination PPTX to disk

//Close the streams

In case you face any issue or need further assistance, please feel free to contact support.

Thanks & Regards,

Hi Ahmad,

Thanks for the reply.

In the example you have taken pptx file as input. Here in our case the input is in the form of InputStream & output I dont want to save to local disk I want to store it in outputStream
Table Cell Background is coming as solid & font colour as white: I want cell background to be white & font colour to be blank . can you please modify the below code ? :

public static void insertTableForTOC(SlideEx slide, Element tableShapeElement, String shapeID) {
ShapeEx tableShape = PPTUtil.findShape(slide, shapeID);
float xCoord = tableShape.getX();
float yCoord = tableShape.getY();
NodeList rowNodeList = tableShapeElement.getElementsByTagName(PPTUtil.TABLE_ROW);
int rowCnt = rowNodeList.getLength();
Element tempRowEle = (Element) rowNodeList.item(0);
NodeList tempCellNodeList = tempRowEle.getElementsByTagName(PPTUtil.TABLE_CELL);
double[] dblCols = new double[tempCellNodeList.getLength()];
double[] dblRows = new double[rowCnt];
for (int i = 0; i < dblRows.length; i++) {
dblRows[i] = 10;
for (int i = 0; i < dblCols.length; i++) {
dblCols[i] = 10;
int id = slide.getShapes().addTable(xCoord, yCoord, dblCols, dblRows);
TableEx table =(TableEx) slide.getShapes().get_Item(id);
RowEx row=table.getRows().get_Item(0);
for(int rCnt = 0; rCnt < rowCnt; rCnt++){
Element rowEle = (Element) rowNodeList.item(rCnt);
NodeList rowCellNodeList = rowEle.getElementsByTagName(PPTUtil.TABLE_CELL);
for (int i = 0; i < rowCellNodeList.getLength(); i++) {
CellEx cell=row.get_Item(i);
ColumnEx col = table.getColumns().get_Item(i);
if(rowCellNodeList.item(i).getFirstChild() != null){
String cellText = rowCellNodeList.item(i).getFirstChild().getNodeValue();
cellText = cellText.trim();

Hi Kranthi,

Please add the following lines of code to set the cell background color as white and cell text color as black.


In case you face any issue, please let us know.

Thanks & Regards,

Thanks Ahmad,

I will test meanwhile

Can you please look into the other issue which is similar to this, below is the link

Aspose Slide: Convert the InputStream into File (Return Type) - Free Support Forum -

Hi Kranthi,

I have replied to your post in the thread you mentioned above.

Thanks & Regards,