The sample source code below will teach you how to change column width and row height in C#. What is ByteScout Spreadsheet SDK? It is the SDK component for writing, reading, modifying, and calculating Excel and CSV spreadsheets. Can calculate and recalculate formulas with Excel installed. You may import or export data to and from CSV, XML, and JSON. Supports export to databases, arrays, and streams. It can help you to change column width and row height in your C# application.
You will save a lot of time on writing and testing code as you may just take the C# code from ByteScout Spreadsheet SDK for changing column width and row height below and use it in your application. In order to implement the functionality, you should copy and paste this code for C# below into your code editor with your app, compile and run your application. Detailed tutorials and documentation are available along with the installed ByteScout Spreadsheet SDK if you’d like to dive deeper into the topic and the details of the API.
A free trial version of ByteScout Spreadsheet SDK is available on our website. Documentation and source code samples are included.
On-demand (REST Web API) version:
Web API (on-demand version)
On-premise offline SDK for Windows:
60 Day Free Trial (on-premise)
using System; using System.Collections.Generic; using System.Text; using Bytescout.Spreadsheet; using System.Diagnostics; using System.IO; namespace Sample { class Program { static void Main(string[] args) { // Create new XLS document Spreadsheet document = new Spreadsheet(); // Create new worksheet Worksheet worksheet = document.Workbook.Worksheets.Add(); // Set column width worksheet.Columns[1].Width = 300; // Set column height worksheet.Rows[1].Height = 100; // delete output file if exists already if (File.Exists("Output.xls")){ File.Delete("Output.xls"); } // Save document document.SaveAs("Output.xls"); // Close Spreadsheet document.Close(); // open in default spreadsheets viewer/editor Process.Start("Output.xls"); } } }
Today we will show you how to change column width and row using C#. To begin, let’s start by opening a Visual Studio app. Then put your code inside Visual Studio. You will see the sample code link in the description box below. Next, let’s add a reference to the spreadsheet SDK DLL.
To do that, right-click on reference in the Solution Explorer and click Add Reference. Then look for ByteScout spreadsheet SDK. After adding the references, let’s set the column width and height values. Now run the program.
We will see the result of the spreadsheet in that we change column width and row.
60 Day Free Trial or Visit ByteScout Spreadsheet SDK Home Page
Explore ByteScout Spreadsheet SDK Documentation
Explore Samples
Sign Up for ByteScout Spreadsheet SDK Online Training
Get Your API Key
Explore Web API Docs
Explore Web API Samples
also available as: