Print to Excel Top Border

stevo_300stevo_300 Member Posts: 7
Hi,

I am creating a report within NAV that prints to excel using the excel buffer.

I am trying to figure out how to apply a top border to the report so it prints a line in the created excel workbook.

This is the code to one of the possible outputs of data. As above I need this to apply a top border to the cells created?
ExcelBuffer.NewRow;
ExcelBuffer.AddColumn("Inbound Warehouse Entry"."Serial No.",FALSE,'',FALSE,FALSE,FALSE,'');
ExcelBuffer.AddColumn("Inbound Warehouse Entry"."Item Description",FALSE,'',FALSE,FALSE,FALSE,'');
ExcelBuffer.AddColumn("Inbound Warehouse Entry"."Date Entered",FALSE,'',FALSE,FALSE,FALSE,'');
ExcelBuffer.AddColumn(Dispatch."Posting Date",FALSE,'',FALSE,FALSE,FALSE,'');
ExcelBuffer.AddColumn(Dispatch."Serial No.",FALSE,'',FALSE,FALSE,FALSE,'');  
ExcelBuffer.AddColumn("Ship-to Address".Name,FALSE,'',FALSE,FALSE,FALSE,'');
ExcelBuffer.AddColumn("Sales Header"."Replacement Ship-to code",FALSE,'',FALSE,FALSE,FALSE,'');  
ExcelBuffer.AddColumn("Inbound Warehouse Entry"."Sales Returns Order No.",FALSE,'',FALSE,FALSE,FALSE,'');
ExcelBuffer.AddColumn("Service Invoice Header"."Ship-to Name",FALSE,'',FALSE,FALSE,FALSE,'');
ExcelBuffer.AddColumn("Service Invoice Header"."No.",FALSE,'',FALSE,FALSE,FALSE,'');
ExcelBuffer.AddColumn(Desc,FALSE,'',FALSE,FALSE,FALSE,'');
ExcelBuffer.AddColumn("Service Invoice Line"."Unit of Measure",FALSE,'',FALSE,FALSE,FALSE,'');
ExcelBuffer.AddColumn("Service Invoice Line".Quantity,FALSE,'',FALSE,FALSE,FALSE,'');
ExcelBuffer.AddColumn("Service Invoice Line"."Fault Code",FALSE,'',FALSE,FALSE,FALSE,'');
ExcelBuffer.AddColumn("Fault Code".Description,FALSE,'',FALSE,FALSE,FALSE,'');
ExcelBuffer.AddColumn("Service Invoice Line"."Fault Reason Code",FALSE,'',FALSE,FALSE,FALSE,'');
ExcelBuffer.AddColumn("Fault Reason Code".Description,FALSE,'',FALSE,FALSE,FALSE,'');

Any help would be greatly appreciated. As a side not is it also possible to get NAV to fill the background of the cells?

Kind Regards

Steve

Comments

  • karthisahakarthisaha Member Posts: 22
    you can make top border by modifying CreateSheet function in Excel buffer Table..

    Try the following..

    Create a new Field in Excel Buffer table- Top Border (type - Boolean).
    and write Code in Create sheet Function

    if "Top Border" then
    XlWrkSht.Range(xlColID + xlRowID).Borders.Item(3).LineStyle := XlContinuous;


    Instead of AddColumn Function, Create a own Function and apply top border where you want.
Sign In or Register to comment.