Home

Bytescout.XLS for .NET
Screenshots

Click to view sample
Click to view sample
Click to view sample
Click to view sample
Click to view sample
Click to view sample
Click to view sample Click to view sample

Bytescout.XLS library for .NET

Download Free Trial Buy Now More Information

How to use different line styles for cells in spreadsheet document (XLS) generated with Bytescout.XLS for .NET

This source code sample demonstrates how to use different line styles for cell formatting while using Bytescout.XLS library

Download example source code: bytescoutxls_different_line_type_styles_for_cells.zip (8 KB)

Output spreadsheet XLS document screenshot:

Different line styles for cells

using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;
using Bytescout.XLS;
using Bytescout.XLS.Constants;

namespace HelloWorld
{
class Program
{
static void Main(string[] args)
{
// Create new XLSDocument
XLSDocument document = new XLSDocument();

// Get worksheet by name
Worksheet worksheet = document.WorkBook.Worksheets.Add();

// Number of cell in the first column
int cellRow = 0;

// Apply all line styles
foreach (LineStyle lineStyle in Enum.GetValues(typeof(LineStyle)))
{
// Set current cell
Cell currentCell = worksheet.Cell(cellRow, 0);

// Set border styles
currentCell.RightBorderStyle =lineStyle;
currentCell.LeftBorderStyle = lineStyle;
currentCell.TopBorderStyle = lineStyle;
currentCell.BottomBorderStyle = lineStyle;

// Print style name
currentCell.Value = lineStyle.ToString();

// Choose next row
cellRow += 2;
}

// Save document
document.SaveAs("LineTypes.xls");

// Close document
document.Close();

// open generated XLS document in default program
Process.Start("LineTypes.xls");
}
}
}

Download example source code: bytescoutxls_different_line_type_styles_for_cells.zip (8 KB)

Download Free Trial Buy Now More Information

Documentation online: view (separate window)

First steps tutorials:

Advanced Examples:
Products  |  Download  |  Purchase  |  Support  |  Contacts  |  Testimonials |  

ByteScout, 2003-2008. All other company and product names may be trademarks of their respective companies. Privacy Statement