Skip to content

Commit

Permalink
Added All option for second cell location in ExcelSplitRangeByColumn
Browse files Browse the repository at this point in the history
  • Loading branch information
openbots-ff committed Mar 26, 2020
1 parent 5b386e3 commit e796c47
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion taskt/Core/Automation/Commands/ExcelGetRangeCommandASDT.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public class ExcelGetRangeCommandAsDT : ScriptCommand
[Attributes.PropertyAttributes.Remarks("")]
public string v_Output { get; set; }
[XmlAttribute]
[Attributes.PropertyAttributes.PropertyDescription("Please Enter the Second Cell Location (ex. A1 or B2, Optional)")]
[Attributes.PropertyAttributes.PropertyDescription("Please Enter the Second Cell Location (ex. A1 or B2, Leave Blank for All)")]
[Attributes.PropertyAttributes.PropertyUIHelper(Attributes.PropertyAttributes.PropertyUIHelper.UIAdditionalHelperType.ShowVariableHelper)]
[Attributes.PropertyAttributes.InputSpecification("Enter the actual location of the cell.")]
[Attributes.PropertyAttributes.SampleUsage("A1, B10, [vAddress]")]
Expand Down
12 changes: 10 additions & 2 deletions taskt/Core/Automation/Commands/ExcelSplitRangeByColumnCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class ExcelSplitRangeByColumnCommand : ScriptCommand
public string v_ExcelCellAddress1 { get; set; }

[XmlAttribute]
[Attributes.PropertyAttributes.PropertyDescription("Please Enter the Second Cell Location (ex. A1 or B2)")]
[Attributes.PropertyAttributes.PropertyDescription("Please Enter the Second Cell Location (ex. A1 or B2, Leave Blank for All)")]
[Attributes.PropertyAttributes.PropertyUIHelper(Attributes.PropertyAttributes.PropertyUIHelper.UIAdditionalHelperType.ShowVariableHelper)]
[Attributes.PropertyAttributes.InputSpecification("Enter the actual location of the cell.")]
[Attributes.PropertyAttributes.SampleUsage("A1, B10, [vAddress]")]
Expand Down Expand Up @@ -88,7 +88,15 @@ public override void RunCommand(object sender)
excelInstance.Visible = false;
excelInstance.DisplayAlerts = false;
Microsoft.Office.Interop.Excel.Worksheet excelSheet = excelInstance.ActiveSheet;
var cellValue = excelSheet.Range[vTargetAddress1, vTargetAddress2];

Microsoft.Office.Interop.Excel.Range cellValue;
if (vTargetAddress2 != "")
cellValue = excelSheet.Range[vTargetAddress1, vTargetAddress2];
else
{
Microsoft.Office.Interop.Excel.Range last = excelSheet.Cells.SpecialCells(Microsoft.Office.Interop.Excel.XlCellType.xlCellTypeLastCell, Type.Missing);
cellValue = excelSheet.Range[vTargetAddress1, last];
}

//Convert Range to DataTable
List<object> lst = new List<object>();
Expand Down

0 comments on commit e796c47

Please sign in to comment.