Question about Styles in Workbooks

  • Thread starter Thread starter Kalaora luc
  • Start date Start date
K

Kalaora luc

I transfert data in a Excel File.

I want that the border of the cell in Excel have only left and right
border.

if i do :
range.Columns.Borders.LineStyle=Excel.XlLineStyle.xlContinuous;

My cell have up, down, left ,right borders. How can have only left and
rigth border ?

Thanks for your answer
 
You need to specify which border you're setting. Currently you're setting it
for all borders.
Change:
range.Columns.Borders.LineStyle = Excel.XlLineStyle.xlContinuous;
To:
range.Columns.Borders[Excel.XlBordersIndex.xlEdgeRight].LineStyle =
Excel.XlLineStyle.Continous;
range.Columns.Borders[Excel.XlBordersIndex.xlEdgeLeft].LineStyle =
Excel.XlLineStyle.Continous;
 
if i do
range.Columns.Borders[Excel.XlBordersIndex.xlEdgeRight].LineStyle =
Excel.XlLineStyle.Continous;
range.Columns.Borders[Excel.XlBordersIndex.xlEdgeLeft].LineStyle =
Excel.XlLineStyle.Continous;

there is no border in my Excel sheet. Have you test it?
Luc
 
Yes, it's tested. Straight from an application we're working on that creates
and formats thousands of reports. Are you also setting the following?

range.Columns.Borders[Excel.XlBordersIndex.xlEdgeRight].Weight
and ColorIndex ?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top