Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Selecting Columns

Francois Botha edited this pageFeb 26, 2018 ·3 revisions

Selecting Columns of a Range

ColumnsOfARange.jpg

varworkbook=newXLWorkbook();varws=workbook.Worksheets.Add("Columns of a Range");// All columns in a rangews.Range("A1:B2").Columns().Style.Fill.BackgroundColor=XLColor.DimGray;varbigRange=ws.Range("A4:V6");// Contiguous columns by numberbigRange.Columns(1,2).Style.Fill.BackgroundColor=XLColor.Red;// Contiguous columns by letterbigRange.Columns("D","E").Style.Fill.BackgroundColor=XLColor.Blue;// Contiguous columns by letterbigRange.Columns("G:H").Style.Fill.BackgroundColor=XLColor.DeepPink;// Spread columns by numberbigRange.Columns("10:11,13:14").Style.Fill.BackgroundColor=XLColor.Orange;// Spread columns by letterbigRange.Columns("P:Q,S:T").Style.Fill.BackgroundColor=XLColor.Turquoise;// Use a single number/letterbigRange.Columns("V").Style.Fill.BackgroundColor=XLColor.Cyan;// Only the used columns in a worksheetws.Columns("A:V").Width=3;

Selecting Columns of a Worksheet

ColumnsOfAWorksheet.jpg

varws2=workbook.Worksheets.Add("Columns of a worksheet");// Contiguous columns by numberws2.Columns(1,2).Style.Fill.BackgroundColor=XLColor.Red;// Contiguous columns by letterws2.Columns("D","E").Style.Fill.BackgroundColor=XLColor.Blue;// Contiguous columns by letterws2.Columns("G:H").Style.Fill.BackgroundColor=XLColor.DeepPink;// Spread columns by numberws2.Columns("10:11,13:14").Style.Fill.BackgroundColor=XLColor.Orange;// Spread columns by letterws2.Columns("P:Q,S:T").Style.Fill.BackgroundColor=XLColor.Turquoise;// Use a single number/letterws2.Columns("V").Style.Fill.BackgroundColor=XLColor.Cyan;ws2.Columns("A:V").Width=3;workbook.SaveAs("SelectingColumns.xlsx");

FAQ

Examples

Real world scenarios

Time Savers

Performance and Memory

Misc

Inserting Data/Tables

Styles

Ranges

Rows

Columns

Page Setup (Print Options)

AutoFilters

Comments

Dev docs

Clone this wiki locally


[8]ページ先頭

©2009-2025 Movatter.jp