Skip to content

Commit e796c47

Browse files
committed
Added All option for second cell location in ExcelSplitRangeByColumn
1 parent 5b386e3 commit e796c47

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

taskt/Core/Automation/Commands/ExcelGetRangeCommandASDT.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public class ExcelGetRangeCommandAsDT : ScriptCommand
4040
[Attributes.PropertyAttributes.Remarks("")]
4141
public string v_Output { get; set; }
4242
[XmlAttribute]
43-
[Attributes.PropertyAttributes.PropertyDescription("Please Enter the Second Cell Location (ex. A1 or B2, Optional)")]
43+
[Attributes.PropertyAttributes.PropertyDescription("Please Enter the Second Cell Location (ex. A1 or B2, Leave Blank for All)")]
4444
[Attributes.PropertyAttributes.PropertyUIHelper(Attributes.PropertyAttributes.PropertyUIHelper.UIAdditionalHelperType.ShowVariableHelper)]
4545
[Attributes.PropertyAttributes.InputSpecification("Enter the actual location of the cell.")]
4646
[Attributes.PropertyAttributes.SampleUsage("A1, B10, [vAddress]")]

taskt/Core/Automation/Commands/ExcelSplitRangeByColumnCommand.cs

+10-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public class ExcelSplitRangeByColumnCommand : ScriptCommand
3535
public string v_ExcelCellAddress1 { get; set; }
3636

3737
[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)")]
3939
[Attributes.PropertyAttributes.PropertyUIHelper(Attributes.PropertyAttributes.PropertyUIHelper.UIAdditionalHelperType.ShowVariableHelper)]
4040
[Attributes.PropertyAttributes.InputSpecification("Enter the actual location of the cell.")]
4141
[Attributes.PropertyAttributes.SampleUsage("A1, B10, [vAddress]")]
@@ -88,7 +88,15 @@ public override void RunCommand(object sender)
8888
excelInstance.Visible = false;
8989
excelInstance.DisplayAlerts = false;
9090
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+
}
92100

93101
//Convert Range to DataTable
94102
List<object> lst = new List<object>();

0 commit comments

Comments
 (0)