Hello,
I am working on excel worksheets from a c# code and I need to get the header from the user and insert it to the sheets .
Does anyone know the c# instruction to insert a header to an excel sheet?
Thank you
Arian
Printable View
Hello,
I am working on excel worksheets from a c# code and I need to get the header from the user and insert it to the sheets .
Does anyone know the c# instruction to insert a header to an excel sheet?
Thank you
Arian
Thank you:)
Do you mean this c# function?
I use it to read data from an excel file or write to the body of a sheet.Code:sheet.get_Range(object cell1,object cell2);
How can I access to the header part by this function?
thank you
No, he doesn't. He means the Range.Insert Method (Microsoft.Office.Interop.Excel) method. (Hint: red = link = click it.)
thank you
I found out about "PageSetup.CenterHeader ". I think it is easier to use :)
here is a sample.
Do you know how I can change the header font size?Code:StringBuilder str = new StringBuilder();
str.Append(@"&""Arial,Regular"+"header text");
sheet = (Excel.Worksheet)wBook1.Sheets[1];
sheet.PageSetup.CenterHeader = str.ToString();
wBook1.Save();
thank you
I found out about "PageSetup.CenterHeader ". I think it is easier to use :)
here is a sample.
Do you know how I can change the header font and size?Code:sheet = (Excel.Worksheet)wBook1.Sheets[1];
sheet.PageSetup.CenterHeader = "header text";
wBook1.Save();
I know one way is to use StringBuilder and Append but I couldnt change the font size.
Code:StringBuilder str = new StringBuilder();
str.Append(@"&""Arial,Regular""test");