Skip to content

Commit 597abcb

Browse files
committed
Add examples for 8.6.2
1 parent 94de2e5 commit 597abcb

File tree

5 files changed

+130
-0
lines changed

5 files changed

+130
-0
lines changed
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/*
2+
* Copyright 2001-2015 Aspose Pty Ltd. All Rights Reserved.
3+
*
4+
* This file is part of Aspose.Cells. The source code in this file
5+
* is only intended as a supplement to the documentation, and is provided
6+
* "as is", without warranty of any kind, either expressed or implied.
7+
*/
8+
package com.aspose.cells.examples.articles;
9+
10+
import com.aspose.cells.*;
11+
import com.aspose.cells.examples.Utils;
12+
13+
public class GetSmartMarkerNotifications {
14+
15+
public static void main(String[] args)
16+
throws Exception {
17+
18+
String dataDir = Utils.getDataDir(GetSmartMarkerNotifications.class);
19+
String outputPath = dataDir + "Output.xlsx";
20+
21+
//Instantiate a new Workbook designer
22+
WorkbookDesigner report = new WorkbookDesigner();
23+
24+
//Get the first worksheet of the workbook
25+
Worksheet sheet = report.getWorkbook().getWorksheets().get(0);
26+
27+
//Set the Variable Array marker to a cell
28+
//You may also place this Smart Marker into a template file manually using Excel and then open this file via WorkbookDesigner
29+
sheet.getCells().get("A1").putValue("&=$VariableArray");
30+
31+
//Set the data source for the marker(s)
32+
report.setDataSource("VariableArray", new String[]{"English", "Arabic", "Hindi", "Urdu", "French"});
33+
34+
//Set the CallBack property
35+
report.setCallBack(new SmartMarkerCallBack(report.getWorkbook()));
36+
37+
//Process the markers
38+
report.process(false);
39+
40+
//Save the result
41+
report.getWorkbook().save(outputPath);
42+
System.out.println("File saved " + outputPath);
43+
}
44+
}
45+
46+
class SmartMarkerCallBack implements ISmartMarkerCallBack {
47+
Workbook workbook;
48+
49+
SmartMarkerCallBack(Workbook workbook) {
50+
this.workbook = workbook;
51+
}
52+
53+
@Override
54+
public void process(int sheetIndex, int rowIndex, int colIndex, String tableName, String columnName) {
55+
System.out.println("Processing Cell: " + workbook.getWorksheets().get(sheetIndex).getName() + "!" + CellsHelper.cellIndexToName(rowIndex, colIndex));
56+
System.out.println("Processing Marker: " + tableName + "." + columnName);
57+
}
58+
}
59+
60+
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*
2+
* Copyright 2001-2015 Aspose Pty Ltd. All Rights Reserved.
3+
*
4+
* This file is part of Aspose.Cells. The source code in this file
5+
* is only intended as a supplement to the documentation, and is provided
6+
* "as is", without warranty of any kind, either expressed or implied.
7+
*/
8+
package com.aspose.cells.examples.articles;
9+
10+
import com.aspose.cells.VbaProject;
11+
import com.aspose.cells.Workbook;
12+
import com.aspose.cells.examples.Utils;
13+
14+
public class RemoveUnusedStyles {
15+
16+
public static void main(String[] args)
17+
throws Exception {
18+
19+
String dataDir = Utils.getDataDir(RemoveUnusedStyles.class);
20+
String inputPath = dataDir + "Styles.xlsx";
21+
String outputPath = dataDir + "Output.xlsx";
22+
23+
Workbook workbook = new Workbook(inputPath);
24+
25+
workbook.removeUnusedStyles();
26+
27+
workbook.save(outputPath);
28+
System.out.println("File saved " + outputPath);
29+
}
30+
}
31+
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
* Copyright 2001-2015 Aspose Pty Ltd. All Rights Reserved.
3+
*
4+
* This file is part of Aspose.Cells. The source code in this file
5+
* is only intended as a supplement to the documentation, and is provided
6+
* "as is", without warranty of any kind, either expressed or implied.
7+
*/
8+
package com.aspose.cells.examples.files.utility;
9+
10+
import com.aspose.cells.Chart;
11+
import com.aspose.cells.Workbook;
12+
import com.aspose.cells.Worksheet;
13+
import com.aspose.cells.examples.Utils;
14+
15+
public class ConvertChartToPdf {
16+
17+
public static void main(String[] args)
18+
throws Exception {
19+
20+
String dataDir = Utils.getDataDir(ConvertChartToPdf.class);
21+
String inputPath = dataDir + "Sample1.xls";
22+
String outputPath = dataDir + "Output-chart.pdf";
23+
24+
//Load excel file containing charts
25+
Workbook workbook = new Workbook(inputPath);
26+
27+
//Access first worksheet
28+
Worksheet worksheet = workbook.getWorksheets().get(0);
29+
30+
//Access first chart inside the worksheet
31+
Chart chart = worksheet.getCharts().get(0);
32+
33+
//Save the chart into pdf format
34+
chart.toPdf(outputPath);
35+
36+
System.out.println("File saved " + outputPath);
37+
}
38+
}
39+
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)