Aspose.cells header & footer

Hi,

I have a worksheet who contains a header and a footer.
The left and right headers contain an image, and the center header 3 lines of text (titles).
The footer just contains one line of text in each section.
How can I put a line at the bottom of the header (full page width) and also at the top of the footer ?

Thanks.

Hi,

Please provide us your sample xlx/xlsx file with the desired header/footer and attach here. You can create one using Ms-Excel manually.

Hi Shakeel Faiz,


Attached you’ll find my code.
What I want is just a line below the header, and one above the footer (whole page width).

Thanks,

Freddy Mellaerts

Hi,

This is an image, please provide Ms-Excel file.

Hi mshakeel.faiz,


I don’t have an xls file with the extra lines, because I don’t know how to put the lines.
So I attach one without lines.

Thanks

Hi,

I think, it is not possible to add a line in header & footer.

However, I have forwarded your requirement to our development team and also have logged this issue in our database.

Once, we have some update relating to it, we will let you know asap.

This issue has been logged as CELLSNET-40312.

Hi,

There is no such a feature in MS Excel. Please set the border of the row or insert a line shape to the worksheet.

But there is only a solution to set the line under the header.

C#


var workbook = new Workbook(@“D:\FileTemp\Example+without+lines.xls”);

Cells cells = workbook.Worksheets[0].Cells;

string printTitleRows = workbook.Worksheets[0].PageSetup.PrintTitleRows;

bool hasTitltRows = false;

if (printTitleRows != null && printTitleRows != “”)

{

hasTitltRows = true;

Range r = cells.CreateRange(printTitleRows);

Row row = cells.Rows[r.FirstRow + r.RowCount - 1];

Style style = row.Style;

style.Borders[BorderType.TopBorder].LineStyle = CellBorderType.Thin;

style.Borders[BorderType.TopBorder].Color = Color.Red;

StyleFlag flag = new StyleFlag();

flag.TopBorder = true;

row.ApplyStyle(style, flag);

}

We are still looking into how to set the line before the footer.