Excel for .NET Samples
Please be advised that this ComponentOne software tool is accompanied by various sample projects and/or demos
which may make use of other development tools included with the ComponentOne Studio.
Please refer to the pre-installed product samples through the following path:
Documents\ComponentOne Samples\WinForms
Click one of the following links to view a list of Excel for .NET samples:
To write code in Visual Basic
Sample Description
AutoSizeColumns The sample loops through all cells measuring their contents, then sets the column widths
based on the widest entry. This sample takes into account the cell contents, format and font.
It does not account for content wrapping or merging. This sample uses the C1XLBook
component.
CellBorders The sample allows you to create borders around arbitrary ranges. You can control border
width, style, color, and so on When you are done creating the borders, click the last button
on the toolbar to export the grid to Excel, including the custom borders. This sample uses
the C1FlexGrid, C1XLBook, and the Microsoft ImageList components.
CombineSheets This sample scans all the .xls files in a folder, clones the first sheet, renames it with the file
name, and adds the cloned sheets to a master workbook. It then saves the combined
workbook into a file and opens that. This sample uses the C1XLBook component.
ExcelPictures This sample creates a workbook with several sheets: "Images" shows a random collection of
images. "Types" shows images of different types. "Borders" shows images with different
border styles. "Alignment" shows how to align and scale images within cells. "Properties"
shows the effect of additional image properties such as brightness, grayscale, and so on. This
sample uses the C1XLBook component.
FlexGridExcel Demonstrates how to load and save XLS files. This sample uses the C1FlexGrid and
C1XLBook components.
HelloWorld This sample actually does more than save a "Hello World" document. It shows how to create
workbooks, assign names to the worksheets, create styles and assign them to cells, assign
content to cells, and save workbooks.. This sample uses the C1XLBook component.
PrintSettings This sample has a Load button that opens an existing XLS file and shows the print settings
for the first sheet. You can modify the print settings, then click the Save button to save a new
file (in the c:\temp folder). The new file is then displayed in Excel . This sample uses the
C1XLBook component.
To write code in C#
Sample Description
AutoSizeColumns The sample loops through all cells measuring their contents, then sets the column widths
based on the widest entry. This sample takes into account the cell contents, format and
font. It does not account for content wrapping or merging. This sample uses the
C1XLBook component.
CellBorders The sample allows you to create borders around arbitrary ranges. You can control border