BoldDesk®Customer service software offering ticketing, live chat, and omnichannel support, starting at $49/mo. for 10 agents. Try it for free.
Hi Matrostik,
Currently XlsIO has support only to preserve macros in the excel file. There is no support for running macros using XlsIO. But this requirement can be achieved by converting the macros in to C# code manually.
Please let me know if you have any other concerns.
Regards,
Vikas S
Hi Matrostik,
Please refer to the below XlsIO code snippets equivalent to the mentioned macro code. XlsIO either directly or by workaround will support most of the functionalities.
Macro Codes |
Equivalent C# code using XlsIO |
lastRow = [A65536].End(xlUp).Row |
int lastRow = GetXlRowTop(1, 65536, Sheets[0].Range["A65536"].IsBlank, Sheets[0]);
private int GetXlRowTop(int coloumnIndex, int rowIndex, bool value, IWorksheet sheet) { for (int row = rowIndex; row >= 1; row--) { if ((sheet.Range[row, coloumnIndex].IsBlank != value)) { return row; } } return 1; } |
[A1:D4].ClearContents |
Range["A1:D4"].Clear(ExcelClearOptions.ClearContent); |
[D3:DF3].SpecialCells(xlCellTypeBlanks).FormulaR1C1 = "=RC[1]" [3:3] = [3:3].Value |
tempRange = Range["D3:DF3"];
for (int cIndex = tempRange.Column; (cIndex <= tempRange.LastColumn); cIndex++) { if ((tempRange[3, cIndex].DisplayText == "")) { tempRange[3, cIndex].FormulaR1C1 = "=RC[1] "; tempRange[3, cIndex].Value = tempRange[3, cIndex].CalculatedValue; } } |
[C:C].Replace What:="H/P", Replacement:="PUT" |
tempRangeCol = Worksheet.FindAll("H/P", ExcelFindType.Text); if (tempRangeCol != null) { for (int index = 0; (index <= (tempRangeCol.Length - 1)); index++) { if ((tempRangeCol[index].Column == 3)) { tempRangeCol[index].Value = "PUT"; } } } |
|
|
Please let us know if you have any concerns.
Regards,
Vikas