Change Row Height in Range of Spreadsheet Cells
This example shows how to change the height of a row, defined by aRange
object, in a spreadsheet.
The Excel®Range
object is a property that takes input arguments. MATLAB® treats such a property as a method. Use themethods
function to get information about creating aRange
object.
创建一个Worksheet
objectws
.
e = actxserver('Excel.Application'); wb = Add(e.Workbooks); e.Visible = 1; ws = e.Activesheet;
Display the default height of all the rows in the worksheet.
ws.StandardHeight
ans = 14.4000
Display the function syntax for creating aRange
object. Search the displayed list for theRange
entry:handle Range(handle,Variant,Variant(Optional))
methods(ws,“全部”)
Methods for class Interface.000208D8_0000_0000_C000_000000000046: Activate(handle) Calculate(handle) handle ChartObjects(handle, Variant(Optional)) CheckSpelling(handle, Variant(Optional)) CircleInvalid(handle) ClearArrows(handle) ClearCircles(handle) Copy(handle, Variant(Optional)) Delete(handle) Variant Evaluate(handle, Variant) ExportAsFixedFormat(handle, XlFixedFormatType, Variant(Optional)) Move(handle, Variant(Optional)) handle OLEObjects(handle, Variant(Optional)) Paste(handle, Variant(Optional)) PasteSpecial(handle, Variant(Optional)) handle PivotTableWizard(handle, Variant(Optional)) handle PivotTables(handle, Variant(Optional)) PrintOut(handle, Variant(Optional)) PrintPreview(handle, Variant(Optional)) Protect(handle, Variant(Optional)) handle Range(handle, Variant, Variant(Optional)) ResetAllPageBreaks(handle) SaveAs(handle, ustring, Variant(Optional)) handle Scenarios(handle, Variant(Optional)) Select(handle, Variant(Optional)) SetBackgroundPicture(handle, ustring) ShowAllData(handle) ShowDataForm(handle) Unprotect(handle, Variant(Optional)) handle XmlDataQuery(handle, ustring, Variant(Optional)) handle XmlMapQuery(handle, ustring, Variant(Optional)) addproperty(handle, string) delete(handle, MATLAB array) deleteproperty(handle, string) MATLAB array events(handle, MATLAB array) MATLAB array get(handle) MATLAB array get(handle, MATLAB array, MATLAB array) MATLAB array get(handle vector, MATLAB array, MATLAB array) MATLAB array invoke(handle) MATLAB array invoke(handle, string, MATLAB array) MATLAB array loadobj(handle) release(handle, MATLAB array) MATLAB array saveobj(handle) MATLAB array set(handle vector, MATLAB array, MATLAB array) MATLAB array set(handle, MATLAB array, MATLAB array) MATLAB array set(handle)
创建一个Range
object consisting of the first row.
wsRange = Range(ws,'A1');
增加行高。
wsRange.RowHeight = 25;
开放的n the worksheet, click in row 1, and notice the height.
Close the workbook without saving.
wb.Saved = 1; Close(e.Workbook)
Close the application.
Quit(e) delete(e)