Skip to content

Instantly share code, notes, and snippets.

@sohail-aspose
sohail-aspose / DeleteBlankRowsAndColumns.cs
Created December 24, 2020 11:49
Delete the blank rows and columns
// Open an existing excel file.
Workbook wb = new Workbook("SampleInput.xlsx");
// Get the worksheets collection in the spreadsheet.
WorksheetCollection sheets = wb.Worksheets;
// Get first Worksheet from WorksheetCollection by index.
Worksheet sheet = sheets[0];
// This option will ensure the references (in formulas, charts)
@sohail-aspose
sohail-aspose / UpdateReferencesWhileDeletingBlankRows.cs
Created December 24, 2020 10:42
Update References While Deleting Blank Rows
// Open an existing excel file.
Workbook wb = new Workbook("SampleInput.xlsx");
// Get the worksheets collection in the spreadsheet.
WorksheetCollection sheets = wb.Worksheets;
// Get first Worksheet from WorksheetCollection by index.
Worksheet sheet = sheets[0];
// This option will ensure the references (in formulas, charts)
@sohail-aspose
sohail-aspose / DeleteBlankRowsFromAllWorksheets.cs
Created December 23, 2020 08:34
Delete Blank Rows from all Worksheets in an Excel file.
// Open an existing excel file.
Workbook workbook = new Workbook("SampleInput.xlsx");
// Iterate over the worksheets.
foreach (Worksheet sheet in workbook.Worksheets)
{
// Delete the Blank Rows from the worksheet.
sheet.Cells.DeleteBlankRows();
}
@sohail-aspose
sohail-aspose / DeleteBlankRows.cs
Created December 23, 2020 06:47
Delete Blank Rows From an Excel Document
using Aspose.Cells;
// Open an existing excel file.
Workbook wb = new Workbook("SampleInput.xlsx");
// Get the worksheets collection in the spreadsheet.
WorksheetCollection sheets = wb.Worksheets;
// Get first Worksheet from WorksheetCollection by index.
Worksheet sheet = sheets[0];
@sohail-aspose
sohail-aspose / mergeJPEGImagesAndSaveAsPNG.cs
Created December 15, 2020 10:44
Merge JPG Images and Save them as PNG
// An array of images you want to merge.
string[] imagePaths = { "Image1.jpeg", "Image2.jpg" };
string outputPath = "MergeHorizontalAsPNG";
// Getting resulting image size.
List<Size> imageSizes = new List<Size>();
foreach (string imagePath in imagePaths)
{
using (RasterImage image = (RasterImage)Image.Load(imagePath))
@sohail-aspose
sohail-aspose / mergeJPEGImagesAndSaveAsPDF.cs
Created December 15, 2020 08:57
Merge JPEG Images and Save them as PDF in C#
// An array of images you want to merge.
string[] imagePaths = { "Image1.jpeg", "Image2.jpg" };
string outputPath = "MergeHorizontalAsPDF";
string tempFilePath = "temp.jpg";
// Getting resulting image size.
List<Size> imageSizes = new List<Size>();
foreach (string imagePath in imagePaths)
{
@sohail-aspose
sohail-aspose / mergeJPEGImagesVertically.cs
Created December 15, 2020 08:10
Merge JPEG Images Vertically In C#
// An array of images you want to merge
string[] imagePaths = { "Image1.jpeg", "Image2.jpg" };
string outputPath = "MergeImages_Vertically.jpg";
// Getting resulting image size.
List<Size> imageSizes = new List<Size>();
foreach (string imagePath in imagePaths)
{
using (RasterImage image = (RasterImage)Image.Load(imagePath))
@sohail-aspose
sohail-aspose / mergeJPEGImagesHorizontally.cs
Last active December 16, 2020 07:39
Merge JPEG Images Horizontally in C#
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Aspose.Imaging;
using Aspose.Imaging.FileFormats.Jpeg;
using Aspose.Imaging.ImageOptions;
using Aspose.Imaging.Sources;
// Array of images you want to merge.
@sohail-aspose
sohail-aspose / mergeJPEGImagesHorizontallyCSharp.cs
Created December 15, 2020 06:03
Merge JPEG Images Horizontally in C#
// Array of Images you want to merge.
string[] imagePaths = { "Image1.jpeg", "Image2.jpg" };
string outputPath = "MergedJPEGImages_Horizontally.jpg";
string tempFilePath = "temp.jpg";
// Getting resulting image size.
List<Size> imageSizes = new List<Size>();
foreach (string imagePath in imagePaths)
{
@sohail-aspose
sohail-aspose / DICOMtoJPEG.java
Created November 17, 2020 09:35
Convert DICOM to JPEG in Java
DicomImage dicomImage = (DicomImage) Image.load("src/main/resources/image.dcm");
// Set the active page to be converted to JPEG
dicomImage.setActivePage(dicomImage.getDicomPages()[0]);
JpegOptions jpegOptions = new JpegOptions();
// Save as JPEG
dicomImage.save("src/main/resources/Output/DICOM_to_JPEG.jpg", jpegOptions);