Ich versuche, erstellen Sie eine Excel-Tabelle und speichern Sie sie in DAM.Ich kann Excel in DAM erstellen, aber keine Daten gibt es in diesem Excel. Ich verwende folgende Codes, um es zu erstellen.So erstellen und speichern Excel-Datei zu DAM mit Java
String filename = "updatedMetadata.xls";
FileOutputStream fos = new FileOutputStream(filename);
WritableWorkbook workbook = Workbook.createWorkbook(new File(filename));
WritableSheet writableSheet = workbook.createSheet("Updated Metadata", 0);
Label label = null;
label = new Label(0, 0, "Header1");
writableSheet.addCell(label);
label = new Label(0, 1, "Header2");
writableSheet.addCell(label);
label = new Label(0, 2, "Header3");
writableSheet.addCell(label);
label = new Label(0, 3, "Header4");
writableSheet.addCell(label);
label = new Label(0, 4, "Header5");
writableSheet.addCell(label);
label = new Label(0, 5, "Header6");
writableSheet.addCell(label);
label = new Label(0, 6, "Header7");
writableSheet.addCell(label);
label = new Label(0, 7, "Header8");
writableSheet.addCell(label);
label = new Label(1, 0, "col val");
writableSheet.addCell(label);
label = new Label(1, 1, "col val");
writableSheet.addCell(label);
label = new Label(1, 2, "col val");
writableSheet.addCell(label);
label = new Label(1, 3, "col val");
writableSheet.addCell(label);
label = new Label(1, 4, "col val");
writableSheet.addCell(label);
label = new Label(1, 5, "col val");
writableSheet.addCell(label);
label = new Label(1, 6, "col val");
writableSheet.addCell(label);
label = new Label(1, 7, "col val");
writableSheet.addCell(label);
label = new Label(2, 0, "col val");
writableSheet.addCell(label);
label = new Label(2, 1, "col val");
writableSheet.addCell(label);
label = new Label(2, 2, "col val");
writableSheet.addCell(label);
label = new Label(2, 3, "col val");
writableSheet.addCell(label);
label = new Label(2, 4, "col val");
writableSheet.addCell(label);
label = new Label(2, 5, "col val");
writableSheet.addCell(label);
label = new Label(2, 6, "col val");
writableSheet.addCell(label);
label = new Label(2, 7, "col val");
writableSheet.addCell(label);
workbook.write();
workbook.close();
ResourceResolver resourceResolver = request.getResourceResolver();
AssetManager manager = resourceResolver.adaptTo(AssetManager.class);
InputStream is = this.getClass().getResourceAsStream("/content/dam/company/fileFolder/" + filename);
Asset asset = manager.createAsset("/content/dam/company/fileFolder/" + filename, is, "application/vnd.ms-excel", true);
Datei wird in diesem Pfad "/ content/dam/Unternehmen/fileFolder /" Dateiname schaffen, ist "updatedMetadata.xls"
Vielen Dank im Voraus Mahesh Narayanan