Skip to content

Instantly share code, notes, and snippets.

View openize-com-gists's full-sized avatar

openize-com-gists

View GitHub Profile
@openize-com-gists
openize-com-gists / ExcelWorksheetTabColorExample.cs
Created March 11, 2025 19:43
This example demonstrates how to programmatically manage worksheet tab colors in Excel using the Openize.OpenXML SDK.
using System;
using System.IO;
using Openize.Cells;
namespace Openize.OpenXML.Sample
{
class Program
{
static void Main(string[] args)
{
@openize-com-gists
openize-com-gists / get-value-from-cell-in-a-workbook.cs
Last active March 3, 2025 15:12
This C# example demonstrates retrieving the data type and value of a specific cell in an Excel worksheet using Openize.Cells SDK.
using System;
using Openize.Cells;
class Program
{
static void Main(string[] args)
{
string filePath = "Z:\\Downloads\\testFile1.xlsx";
using (var wb = new Openize.Cells.Workbook(filePath))
@openize-com-gists
openize-com-gists / rename-excel-sheet-in-cshap.cs
Last active March 3, 2025 15:12
This C# example demonstrates renaming a worksheet in an Excel workbook using Openize.Cells SDK.
using System;
using Openize.Cells;
class Program
{
static void Main(string[] args)
{
string filePath = "Z:\\Downloads\\testFile1.xlsx";
string existingSheetName = "TestSheet";
string newSheetName = "RenameSheetName";
@openize-com-gists
openize-com-gists / get-document-properties-to-a-workbook.cs
Last active March 3, 2025 15:12
This C# example demonstrates retrieving and displaying built-in document properties from an Excel workbook using Openize.Cells SDK.
using System;
using Openize.Cells;
class Program
{
static void Main(string[] args)
{
string filePath = "/path/to/existing/spreadsheet.xlsx"; // Replace with the path to your file
// Open the existing workbook.
@openize-com-gists
openize-com-gists / protect-worksheet-in-a-workbook.cs
Last active March 3, 2025 15:12
This C# example demonstrates protecting an Excel worksheet with a password using Openize.Cells SDK.
using System;
using Openize.Cells;
class Program
{
static void Main(string[] args)
{
string filePath = "Z:\\Downloads\\test_spreadsheet.xlsx"; // Replace with the path to your file
using (var workbook = new Openize.Cells.Workbook(filePath))
@openize-com-gists
openize-com-gists / set-row-height-set-column-width-in-worksheet.cs
Last active March 3, 2025 15:12
This C# example demonstrates creating an Excel workbook with custom row height, column width, and cell values using Openize.Cells SDK.
using System;
using Openize.Cells;
class Program
{
static void Main(string[] args)
{
string filePath = "Z:\\Downloads\\test_spreadsheet.xlsx";
// Initialize a new workbook instance
@openize-com-gists
openize-com-gists / style-excel-worksheet-content-with-student-data.cs
Last active March 3, 2025 15:12
This C# example demonstrates creating an Excel spreadsheet with custom styling, including different font styles and colors for headers, even rows, and odd rows using Openize.Cells SDK.
using System;
using Openize.Cells;
class Program
{
static void Main(string[] args)
{
// Define the path where the spreadsheet will be saved.
string filePath = "Z:\\Downloads\\spreadsheet_test.xlsx";
@openize-com-gists
openize-com-gists / insert-rows-into-worksheet.cs
Last active March 3, 2025 15:12
This C# example showcases how to programmatically insert rows into an Excel worksheet at a specified row index using the FileFormat.Cells library.
using System;
using Openize.Cells;
class Program
{
static void Main(string[] args)
{
string filePath = "Z:\\Downloads\\test_spreadsheet.xlsx";
// Load the workbook from the specified file path
@openize-com-gists
openize-com-gists / add-formula-to-cells.cs
Last active March 3, 2025 15:12
This C# example demonstrates adding random numbers to cells and creating a sum formula in an Excel worksheet using Openize.Cells SDK.
using System;
using Openize.Cells;
class Program
{
static void Main(string[] args)
{
string filePath = "Z:\\Downloads\\test_spreadsheet.xlsx";
using (var wb = new Openize.Cells.Workbook())
@openize-com-gists
openize-com-gists / remove-sheet-from-a-workbook
Last active March 3, 2025 15:12
This C# example demonstrates removing a specific worksheet from an Excel workbook using Openize.Cells SDK, with error handling for sheet not found.
using System;
using Openize.Cells;
class Program
{
static void Main(string[] args)
{
string filePath = "Z:\\Downloads\\test_spreadsheet.xlsx"; // Replace with the path to your file
using (var workbook = new Openize.Cells.Workbook(filePath))