Hi, I’m willing to know whether Aspose support DDE in Words and PowerPoints.
The DDE that I’m referring to is between two applications one being the DDE server and the other (Word or PowerPoint document) being the client.
My goal is to remove the DDE from the documents. can i do so using Aspose?
@Gal10BS,
Thank you for posting the question.
Unfortunately, I’m not entirely sure what you mean. Could you kindly share sample files and indicate the DDE in the documents?
Hi, sorry for the delay.
I managed to do what i wanted in docx files. However, I am still having issues with ppt files.
here is what I did with word:
public Resdata RemoveDDE(Document document, JSONObject analysis_data){
try{
for (Field field : document.getRange().getFields())
if (field.getType() == FieldType.FIELD_DDE || field.getType() == FieldType.FIELD_DDE_AUTO){
analysis_data = json_util.addToAnalysisAttribution("has_dde",true, analysis_data);
field.remove();
analysis_data = json_util.addToAnalysisAttribution("removed_dde",true, analysis_data);
analysis_data.put("to_quarantine",false);
}
}
catch (Exception e){
analysis_data.put("to_quarantine",true);
analysis_data = json_util.addToQuarantineList("quarantine_list","Failed to remove DDE", analysis_data);
LOG.warn("Failed to remove DDE !", e);
//@todo if it fails it should be deleted
Resdata resdata = new Resdata(document, analysis_data);
return resdata;
}
Resdata resdata = new Resdata(document, analysis_data);
return resdata;
}
Is there a way to do something similar with ppt files?
@Gal10BS,
Unfortunately, I couldn’t understand what you mean. Could you kindly share a sample presentation file?
Unfortunately, I don’t have a pptx file with DDE (DDE - Dynamic Data Exchange).
Moreover, in this site of Microsoft - Securely opening documents that have Dynamic Data Exchange fields - Microsoft 365 Apps | Microsoft Learn
there is no reference to DDE in PowerPoint at all.
Instead of PowerPoint. Can you please help with Excel files (xlsx, xlsm) to Remove the DDE like I did in the code for Word files.
@Gal10BS,
Thank you for the details. PowerPoint presentations can contain charts. Usually, data for the charts are stored in Excel files. So I think presentations can contain DDE. You can extract chart data (an Excel file) from a presentation as below
byte[] workbookData = chart.getChartData().readWorkbookStream();
and use Aspose.Cells to remove the DDE (if it is supported).
PowerPoint Charts|Aspose.Slides Documentation
My colleagues from Aspose.Cells team will assist you shortly.
@amjad.sahi FYI
@Gal10BS,
For Excel spreadsheets, the options mentioned in the document to disable the DDE features are Excel application or windows level settings which cannot be implemented via Aspose.Cells (being file formats APIs). All you can do is remove DDE links from Excel files via the following APIs.
- ExternalLinkCollection.clear() → to remove all the external (DDE) links from the Excel file.
- ExternalLinkCollection.removeAt() → to remove specific external link from the collection.
e.g.,
Sample code:
//Open a file with external links
Workbook workbook = new Workbook("book1.xlsx");
//Remove all the external (DDE) links from the workbook
workbook.getWorksheets().getExternalLinks().clear();
//Remove the first external link from the collection from the file.
workbook.getWorksheets().getExternalLinks().removeAt(0);
Hope, this helps a bit.
Thank you both!
I appreciate your help.
@Gal10BS,
Thank you for using Aspose products.