Hi Guys.I need to add all border to the excel cells.Can anyone help me with this.Thanks in advance
The possible solutions(to be used based on business scenario) that i could think of are-
- Using Template file
- Create an excel file as template and add all the formatting you want.
- Add steps in BOT to create a new excel file in the required location as a copy of the template file specified above.
- Use write range activity to enter data into the file. Write range will write only the data into the files and do not change the original format.
- Formatting Excel
- Open excel file.
- Do ctrl+a.
- Got to Home tab and then click the Border > All Borders . See screen shot below
- Save the file and close
Hope this is helpful!
If this resolves your issue, please mark it as solution so that people facing similar issues can directly navigated to answer.
First select the range of cells using “Select Range” activity or using “Ctrl+A” hotkey. Then you can add all border by sending the hotkey “Alt+Shift+b+h+a” inside an excel application scope.
control +b is not working for bold text.Any other way is there?
For Border write the below code in the Invoke Code Acitivity
Dim excel As Microsoft.Office.Interop.Excel.Application
Dim wb As Microsoft.Office.Interop.Excel.Workbook
Dim ws As Microsoft.Office.Interop.Excel.Worksheet
Dim rng As Microsoft.Office.Interop.Excel.Range
excel = New Microsoft.Office.Interop.Excel.ApplicationClass
wb = excel.Workbooks.Open(“File Path”)
ws.Range(“A1:C1”).Cells.Borders.LineStyle = XlLineStyle.xlContinuous
ws.Range(“A1:C1”).Font.Bold = True
This activity sets border to cell or cell range.
Hi @Ilayaraja I am trying your code but tell me --> “XlLineStyle” undeclared. How can i do that?
Thanks in advance
This is excellent , Thanks for these short cuts , where can I find more of these?