@@ -35,7 +35,7 @@ public class ExcelSplitRangeByColumnCommand : ScriptCommand
35
35
public string v_ExcelCellAddress1 { get ; set ; }
36
36
37
37
[ XmlAttribute ]
38
- [ Attributes . PropertyAttributes . PropertyDescription ( "Please Enter the Second Cell Location (ex. A1 or B2)" ) ]
38
+ [ Attributes . PropertyAttributes . PropertyDescription ( "Please Enter the Second Cell Location (ex. A1 or B2, Leave Blank for All )" ) ]
39
39
[ Attributes . PropertyAttributes . PropertyUIHelper ( Attributes . PropertyAttributes . PropertyUIHelper . UIAdditionalHelperType . ShowVariableHelper ) ]
40
40
[ Attributes . PropertyAttributes . InputSpecification ( "Enter the actual location of the cell." ) ]
41
41
[ Attributes . PropertyAttributes . SampleUsage ( "A1, B10, [vAddress]" ) ]
@@ -88,7 +88,15 @@ public override void RunCommand(object sender)
88
88
excelInstance . Visible = false ;
89
89
excelInstance . DisplayAlerts = false ;
90
90
Microsoft . Office . Interop . Excel . Worksheet excelSheet = excelInstance . ActiveSheet ;
91
- var cellValue = excelSheet . Range [ vTargetAddress1 , vTargetAddress2 ] ;
91
+
92
+ Microsoft . Office . Interop . Excel . Range cellValue ;
93
+ if ( vTargetAddress2 != "" )
94
+ cellValue = excelSheet . Range [ vTargetAddress1 , vTargetAddress2 ] ;
95
+ else
96
+ {
97
+ Microsoft . Office . Interop . Excel . Range last = excelSheet . Cells . SpecialCells ( Microsoft . Office . Interop . Excel . XlCellType . xlCellTypeLastCell , Type . Missing ) ;
98
+ cellValue = excelSheet . Range [ vTargetAddress1 , last ] ;
99
+ }
92
100
93
101
//Convert Range to DataTable
94
102
List < object > lst = new List < object > ( ) ;
0 commit comments