Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Examples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<dependency>
<groupId>com.aspose</groupId>
<artifactId>aspose-cells</artifactId>
<version>8.4.2</version>
<version>8.6.0</version>
</dependency>
</dependencies>
<repositories>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Copyright 2001-2015 Aspose Pty Ltd. All Rights Reserved.
*
* This file is part of Aspose.Cells. The source code in this file
* is only intended as a supplement to the documentation, and is provided
* "as is", without warranty of any kind, either expressed or implied.
*/
package com.aspose.cells.examples.articles;

import com.aspose.cells.*;
import com.aspose.cells.examples.Utils;

public class AssignMacroToFormControl {

public static void main(String[] args) throws Exception {
// The path to the documents directory.
String dataDir = Utils.getDataDir(AssignMacroToFormControl.class);

Workbook workbook = new Workbook();
Worksheet sheet = workbook.getWorksheets().get(0);

int moduleIdx = workbook.getVbaProject().getModules().add(sheet);
VbaModule module = workbook.getVbaProject().getModules().get(moduleIdx);
module.setCodes("Sub ShowMessage()" + "\r\n" +
" MsgBox \"Welcome to Aspose!\"" + "\r\n" +
"End Sub");

Button button = (Button) sheet.getShapes().addShape(MsoDrawingType.BUTTON, 2, 0, 2, 0, 28, 80);
button.setPlacement(PlacementType.FREE_FLOATING);
button.getFont().setName("Tahoma");
button.getFont().setBold(true);
button.getFont().setColor(Color.getBlue());
button.setText("Aspose");

workbook.save(dataDir + "Output.xlsm");

System.out.println("File saved");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Copyright 2001-2015 Aspose Pty Ltd. All Rights Reserved.
*
* This file is part of Aspose.Cells. The source code in this file
* is only intended as a supplement to the documentation, and is provided
* "as is", without warranty of any kind, either expressed or implied.
*/
package com.aspose.cells.examples.articles;

import com.aspose.cells.HtmlSaveOptions;
import com.aspose.cells.Workbook;
import com.aspose.cells.examples.Utils;

public class HtmlExportFrameScripts {

public static void main(String[] args) throws Exception {
// The path to the documents directory.
String dataDir = Utils.getDataDir(HtmlExportFrameScripts.class);

// Open the required workbook to convert
Workbook w = new Workbook(dataDir + "Sample1.xlsx");

// Disable exporting frame scripts and document properties
HtmlSaveOptions options = new HtmlSaveOptions();
options.setExportFrameScriptsAndProperties(false);

// Save workbook as HTML
w.save(dataDir + "output.html", options);

System.out.println("File saved");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Copyright 2001-2015 Aspose Pty Ltd. All Rights Reserved.
*
* This file is part of Aspose.Cells. The source code in this file
* is only intended as a supplement to the documentation, and is provided
* "as is", without warranty of any kind, either expressed or implied.
*/
package com.aspose.cells.examples.articles;

import com.aspose.cells.MetadataOptions;
import com.aspose.cells.MetadataType;
import com.aspose.cells.Workbook;
import com.aspose.cells.WorkbookMetadata;
import com.aspose.cells.examples.Utils;

public class UsingWorkbookMetadata {

public static void main(String[] args) throws Exception {
// The path to the documents directory.
String dataDir = Utils.getDataDir(UsingWorkbookMetadata.class);


// Open Workbook metadata
MetadataOptions options = new MetadataOptions(MetadataType.DOCUMENT_PROPERTIES);
WorkbookMetadata meta = new WorkbookMetadata(dataDir + "Sample1.xlsx", options);

// Set some properties
meta.getCustomDocumentProperties().add("test", "test");

// Save the metadata info
meta.save(dataDir + "Sample2.xlsx");

// Open the workbook
Workbook w = new Workbook(dataDir + "Sample2.xlsx");

// Read document property
System.out.println(w.getCustomDocumentProperties().get("test"));
}
}
Binary file not shown.
Binary file not shown.