Hi ,
I have been working on creation of a document generation framework using Aspose.Slides library v2.5.0.
I have used PresentationEx class for generation and rendering of the documents.
An example function to retrieve document post rendering is
public byte[] getFinalDocument()
{
if (finalDocument == null & (binary == true))
{
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PresentationEx pres = new PresentationEx(location);
try
{
pres.save(baos, SaveFormat.PPTX);
}
catch (IOException e)
{
logger.logError(getClass(), e.getMessage(), e);
}
finalDocument = baos.toByteArray();
}
return finalDocument;
}
}
I have saved the documents using following -
pres.save(baos, SaveFormat.PPTX);
Now the issue, I am facing is, whenever there is a document created in MS Powerpoint 2003 format it doesnt get uploaded or saved or results in error when opened.
Can you please help me find a feasible approach through which i can incorporate support for 2003 document generation.
What all steps that it requires in this regard.
Pleas let me know if my query is not clear enough and you need more information corresponding to this.
Hi Harry,
Hi Mudassir,
I am trying to produce a document in 2003 format using Aspose.Slides java library 7.3
The code as follows:
//Instantiate a Presentation object that represents a PPT file
Presentation pres = new Presentation();
Slide slide = pres.getSlides().get_Item(0);
//Setting table parameters
int xPosition = 880;
int yPosition = 1400;
int tableWidth = 4000;
int tableHeight = 500;
int columns = 4;
int rows = 4;
double borderWidth = 2;
//Adding a new table to the slide using specified table parameters
Table table = slide.getShapes().addTable(xPosition, yPosition, tableWidth, tableHeight,
columns, rows, borderWidth, Color.blue);
//Setting the alternative text for the table that can help in future to find
//and identify this specific table
table.setAlternativeText(“myTable”);
//Merging two cells
table.mergeCells(table.getCell(0, 0), table.getCell(1, 0));
//Accessing the text frame of the first cell of the first row in the table
TextFrame tf = table.getCell(0, 0).getTextFrame();
//If text frame is not null then add some text to the cell
if (tf != null)
{
tf.getParagraphs().get_Item(0).getPortions().get_Item(0).setText(“Welcome to Aspose.Slides”);
}
//Writing the presentation as a PPT file
pres.write(“C:\Test.ppt”);
It is resulting in the following error ;
Exception in thread “main” java.lang.NoSuchMethodError: com.aspose.slides.Presentation.getSlides()Lcom/aspose/slides/SlideCollection;
at TestSlides2003.main(TestSlides2003.java:21)
Is Presentation class obsolete in the Aspose.Slides 7.3 version ?
Do I need to use PresentationEx class for generating document in 2003 format as well ?
Kindly help.
Can you please give me a Sample code which uses PresentationEx class from Aspose.Slides java v 7.3, in order to generate Powerpoint document in 2003 format.
Kindly provide all the system configuration required as in JDK version, Aspose.Slides library
and other configuration details that is mandatory to execute the program.
Thanks
Hi Harry,
I have worked with the sample code shared as it is by just changing the destination path on my end. I have not been able to observe an issue while using Aspose.Slides for Java 7.3.0 with JDK 1.6_35 in Windows 7 x64 environment. The Presentation class has not been obsoleted and is still in use for PowerPoint presentation formats from 97 to 2003.
You can also generate the PowerPoint 2007 to 2010 format presentations with tables as well. Please visit this documentation link for your convenience. However, if you are looking for support that PresentationEx may generate 97~2003 format PPT presentation, I regret to share that the feature support is unavailable presently in Aspose.Slides. If you install the comparability pack in PowerPoint 2003, you can even open 97~2003 PPTX format presentation in that as well.
Please share the complete environment, operating system and java details with us if the issue still incurs on your end as I failed to reproduce the issue on my side.
Many Thanks,