Skip to content

Instantly share code, notes, and snippets.

@conholdate-gists
conholdate-gists / merge-pptx-presentation.java
Created November 13, 2024 13:37
Merge PowerPoint Presentation in Java | Combine Slides
com.aspose.slides.Presentation pres1 = new com.aspose.slides.Presentation("pres1.pptx");
try {
com.aspose.slides.Presentation pres2 = new com.aspose.slides.Presentation("pres2.pptx");
try {
for(com.aspose.slides.ISlide slide : pres2.getSlides())
{
pres1.getSlides().addClone(slide);
}
} finally {
if (pres2 != null) pres2.dispose();
@conholdate-gists
conholdate-gists / protect-presentation.java
Created November 11, 2024 19:31
Password Protect PowerPoint Presentation in Java
com.aspose.slides.Presentation presentation = new com.aspose.slides.Presentation("pres.pptx");
try {
presentation.getProtectionManager().encrypt("123123");
presentation.save("encrypted-pres.pptx", com.aspose.slides.SaveFormat.Pptx);
} finally {
if (presentation != null) presentation.dispose();
}
@conholdate-gists
conholdate-gists / scan-barcode-word-document.cs
Created November 6, 2024 20:35
Scan Barcode from Word Document in C#
// Open the Word document
Aspose.Words.Document wordDoc = new Aspose.Words.Document("BarcodeDocument.docx");
// Process all word pages
for (int i = 0; i < wordDoc.PageCount; ++i)
{
// Create options to save
Aspose.Words.Saving.ImageSaveOptions wordSaveOptions = new Aspose.Words.Saving.ImageSaveOptions(Aspose.Words.SaveFormat.Png);
// Set required page
@conholdate-gists
conholdate-gists / Convert-MPP-to-CSV-change-view.cs
Created November 5, 2024 14:02
Convert MPP to CSV in C# | Microsoft Project File to Comma Separated File
// Load the input MPP file
Aspose.Tasks.Project project = new Aspose.Tasks.Project("New Project.mpp");
// Create CsvOptions class object
CsvOptions options = new CsvOptions();
// To change what columns will be exported the DataCategory property can be used
// changing the data category from DataCategory.Tasks to DataCategory.Resources
options.DataCategory = DataCategory.Resources;
@conholdate-gists
conholdate-gists / convert-mpp-to-excel-xlsx.cs
Created October 31, 2024 18:38
Convert MPP to Excel XLSX in C# | Microsoft Project File to Excel XLS
// Load the input MPP file
Aspose.Tasks.Project project = new Aspose.Tasks.Project("New Project.mpp");
// Initiate XlsxOptions class object
Aspose.Tasks.Saving.XlsxOptions options = new Aspose.Tasks.Saving.XlsxOptions();
options.PageSize = Aspose.Tasks.Visualization.PageSize.A4;
// Convert MS Project MPP to Excel XLSX
project.Save("MS Project.xlsx", options);
@conholdate-gists
conholdate-gists / scan-qr-code.java
Created October 30, 2024 12:42
Scan QR Code in Java | Read QR Code
// Initialize barcode reader
BarCodeReader reader = new BarCodeReader(dataDir + "Scan-QR-java.png");
// Scan the QR Code
for (BarCodeResult result : reader.readBarCodes()) {
System.out.println("CodeText: " + result.getCodeText());
}
@conholdate-gists
conholdate-gists / convert-vsdx-to-html.java
Created October 29, 2024 20:36
Convert Visio to HTML in Java | VSDX to HTML Webpage
// Load a diagram from a VSDX file
com.aspose.diagram.Diagram diagram = new com.aspose.diagram.Diagram("input.vsdx");
// Save Visio VSDX as HTML
diagram.save("ExportToHTML.html", com.aspose.diagram.SaveFileFormat.HTML);
@conholdate-gists
conholdate-gists / convert-excel-to-fods.cs
Created October 28, 2024 14:33
Convert Excel to OpenDocument Spresheet in C# | Excel XLSX to ODS or FODS
// Load your source workbook
Workbook workbook = new Workbook("input.xlsx");
// Save as FODS file
workbook.Save("output.fods");
@conholdate-gists
conholdate-gists / convert-dxf-to-png-image.java
Created October 22, 2024 21:32
Convert DXF to PNG JPG Image in Java
// Load the input file
String srcFile = dataDir + "conic.dxf";
com.aspose.cad.Image image = com.aspose.cad.Image.load(srcFile);
// Create an instance of CadRasterizationOptions
com.aspose.cad.imageoptions.CadRasterizationOptions rasterizationOptions = new com.aspose.cad.imageoptions.CadRasterizationOptions();
// Set page width & height
rasterizationOptions.setPageWidth(1200);
rasterizationOptions.setPageHeight(1200);
@conholdate-gists
conholdate-gists / extract-table-from-pdf.cs
Created October 22, 2024 10:45
Extract Table from PDF in C#
// Load source PDF document
var filePath = "input.pdf";
Aspose.Pdf.Document pdfDocument = new Aspose.Pdf.Document(filePath);
foreach (var page in pdfDocument.Pages)
{
Aspose.Pdf.Text.TableAbsorber absorber = new Aspose.Pdf.Text.TableAbsorber();
absorber.Visit(page);
foreach (AbsorbedTable table in absorber.TableList)
{
Console.WriteLine("Table");