ByteScout Data Extraction Suite - C# - Set cell alignment with spreadsheet sdk - ByteScout

ByteScout Data Extraction Suite – C# – Set cell alignment with spreadsheet sdk

  • Home
  • /
  • Articles
  • /
  • ByteScout Data Extraction Suite – C# – Set cell alignment with spreadsheet sdk

How to set cell alignment with spreadsheet sdk in C# and ByteScout Data Extraction Suite

This code in C# shows how to set cell alignment with spreadsheet sdk with this how to tutorial

The coding instructions are formulated to help you to try-out the features without the requirement to write your own code. ByteScout Data Extraction Suite is the bundle that includes three SDK tools for data extraction from PDF, scans, images and from spreadsheets: PDF Extractor SDK, Data Extraction SDK, Barcode Reader SDK. It can be applied to set cell alignment with spreadsheet sdk using C#.

Want to save time? You will save a lot of time on writing and testing code as you may just take the C# code from ByteScout Data Extraction Suite for set cell alignment with spreadsheet sdk below and use it in your application. Simply copy and paste in your C# project or application you and then run your app! Further improvement of the code will make it more robust.

You can download free trial version of ByteScout Data Extraction Suite from our website with this and other source code samples for C#.

On-demand (REST Web API) version:
 Web API (on-demand version)

On-premise offline SDK for Windows:
 60 Day Free Trial (on-premise)

Program.cs
      
using System; using System.Collections.Generic; using System.Text; using Bytescout.Spreadsheet; using System.Diagnostics; using System.IO; namespace HelloWorld { class Program { static void Main(string[] args) { // Create new Spreadsheet Spreadsheet document = new Spreadsheet(); // Add new worksheet Worksheet worksheet = document.Workbook.Worksheets.Add("AlignmentDemo"); // Set Values worksheet.Cell("A1").Value = "Name"; // setting centered alignment for the cell worksheet.Cell("A1").AlignmentHorizontal = Bytescout.Spreadsheet.Constants.AlignmentHorizontal.Centered; worksheet.Cell("B1").Value = "Full Name"; // setting centered alignment for the cell worksheet.Cell("B1").AlignmentHorizontal = Bytescout.Spreadsheet.Constants.AlignmentHorizontal.Centered; worksheet.Cell("A2").Value = "Homer"; // setting justifiedalignment for the cell worksheet.Cell("A2").AlignmentHorizontal = Bytescout.Spreadsheet.Constants.AlignmentHorizontal.Right; worksheet.Cell("B2").Value = "Homer Jay Simpson"; // setting justified alignment for the cell worksheet.Cell("B2").AlignmentHorizontal = Bytescout.Spreadsheet.Constants.AlignmentHorizontal.Right; // set columns width worksheet.Columns[0].Width = 300; // A column worksheet.Columns[1].Width = 400; // B column // delete output file if exists already if (File.Exists("CellAlignment.xls")){ File.Delete("CellAlignment.xls"); } // Save document document.SaveAs("CellAlignment.xls"); // open XLS document in default XLS Excel documents application Process.Start("CellAlignment.xls"); } } }

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout Data Extraction Suite Home Page

Explore ByteScout Data Extraction Suite Documentation

Explore Samples

Sign Up for ByteScout Data Extraction Suite Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

VIDEO

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout Data Extraction Suite Home Page

Explore ByteScout Data Extraction Suite Documentation

Explore Samples

Sign Up for ByteScout Data Extraction Suite Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

Tutorials:

prev
next