HI Rashid,
I want word,ppt,excel with embedded files needs to be converted to PDF.Is that possible?
Thanks much!
Anand
HI Rashid,
I want word,ppt,excel with embedded files needs to be converted to PDF.Is that possible?
Thanks much!
Anand
Hi Anand,
Hi,
Thanks for your consideration of Aspose.Total
Aspose.Cells for .NET, which is a part of Aspose.Total, can convert your Ms-Excel files into pdf.
Please see this documentation article for your more help.
Hi,
I tried Excel to PDF in Aspose total.java and working fine.But I have excel sheet with embedded objects like word and ppt inside the excel sheet.Is it possible to convert that as well using Aspose?or even if it possible to read those word/ppt inside the excel and store it in some location is enough.Is that possible.
Note:I tried reading embedded file inside the word document and I could store in some location.But I dont find any sample codes for excel and ppt.If you share the sample codes that will be very helpful.
Thanks
Anand
Hi Anand,
Thank you very much.
We may need to decide today that which tool we need to use.Aspose is really great.
I am wondering whether below two as well is possible using Aspose?
1.Conversion of Excel to PDF having Macros.
2.Is it possible to convert DXL file(Lotus note mail file) to PDF using Aspose?
Hi,
Hi Anand,
Hi,
I could be able to extract the embedded files in the doucment.But I dont find any methods to get the actual name of the embedded files in a word document .Please help to get the actaul name of the embedded files in a document.Here is the code I am using.
shape.getOleFormat().save(String.format("C:\\Temp\\Aspose\\Embedded\\Filename_", i, extension));I am just using Filename_i for the extracted embedded object.It would be great if i get the orginal file name.
Document doc = new Document("C:\\Temp\\Aspose\\Photo of business.DOCX");
// Get all shapes.
NodeCollection shapes = doc.getChildNodes(NodeType.SHAPE, true);
// Loop through all shapes.
for (int i = 0; i < shapes.getCount(); i++) {
Shape shape = (Shape)shapes.get(i);
System.out.println(i+"---"+shape.getOleFormat().getProgId());
// Check if the current shape has OLE object
if (shape.getOleFormat() == null)
continue;
// Determine extenfion of the object.
// Let's use bin extension by default.
String extension = "bin";
// String extension = "bin";
if (shape.getOleFormat().getProgId().equals("Word.Document.8"))
extension = "doc";
if (shape.getOleFormat().getProgId().equals("Word.Document.12"))
extension = "docx";
if (shape.getOleFormat().getProgId().equals("Excel.Sheet.8"))
extension = "xls";
if (shape.getOleFormat().getProgId().equals("Excel.Sheet.12"))
extension = "xlsx";
if (shape.getOleFormat().getProgId().equals("PowerPoint.Show.8"))
extension = "ppt";
if (shape.getOleFormat().getProgId().equals("PowerPoint.Show.12"))
extension = "pptx";
// try {
// shape.getOleFormat().save(String.format("C:\\Temp\\Aspose\\EmbedTest", shape.getOleFormat().getSourceFullName(), extension));
// }
// Save OLE object.
shape.getOleFormat().save(String.format("C:\\Temp\\Aspose\\Embedded\\Filename_", i, extension));
}
Hi ,
Could any one please update on the above question?
Thank you.
Hi Anand,
Thanks for your inquiry.
Sure, you can get the source file name if the OLE object is linked by using OleFormat.SourceFullName property; otherwise, I am afraid, if the object is embedded, you cannot get the source file name.
If we can help you with anything else, please feel free to ask.
Best Regards,
Thanks for the reply.
I am facing another issue while executing the below code.code is working fine for documents without embedded objects.But getting access denied error to the destination path while saving the embedded objects.Please help.I am pasting the code here.
public void convertWordToPdf(String destintaion,String fileNamewithExtn,List convertedFileNames,DocumentToPDFConverter docconverter){
String fileName=AppHelper.getFileName(destintaion+fileNamewithExtn);
try {
String inputFile=destintaion+fileNamewithExtn;
String outputFile=destintaion+fileName+ApplicationConstants.pdf;
Document doc = new Document(inputFile);
doc.save(outputFile);
convertedFileNames.add(fileName+ApplicationConstants.pdf);
extractEmbeddedObjects(doc,fileName,destintaion,convertedFileNames,docconverter);
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* Extracts Embedded attachment in a document
* @param document object
*/
public void extractEmbeddedObjects(Document doc,String fileName,String destination,List convertedFileNames,DocumentToPDFConverter docconverter){
boolean flag=true;
NodeCollection shapes = doc.getChildNodes(NodeType.SHAPE, true);
for (int i = 0; i < shapes.getCount(); i++) {
Shape shape = (Shape)shapes.get(i);
if (shape.getOleFormat() == null)
continue;
String extension=null;
if (shape.getOleFormat().getProgId().equals(“Word.Document.8”))
extension = “doc”;
else if (shape.getOleFormat().getProgId().equals(“Word.Document.12”))
extension = “docx”;
else if (shape.getOleFormat().getProgId().equals(“Excel.Sheet.8”))
extension = “xls”;
else if (shape.getOleFormat().getProgId().equals(“Excel.Sheet.12”))
extension = “xlsx”;
else if (shape.getOleFormat().getProgId().equals(“PowerPoint.Show.8”))
extension = “ppt”;
else if (shape.getOleFormat().getProgId().equals(“PowerPoint.Show.12”))
extension = “pptx”;
else
flag=false;
try {
shape.getOleFormat().save(String.format(destination, i+"", extension));//Here i am getting exception
if(flag==true){
convertWordToPdf(destination,fileName+""+i+"."+extension,convertedFileNames,docconverter);
}
}
catch(Exception e){
e.printStackTrace();
}
}
}
Below is the excpetion message:
C:\Temp\SinglePDF\Standalone\Output\2012-07-06 17-52-36-163 (Access is denied.)
Note the the file without embedded objects are saved to same extenstion mentioned above without any issues.