Options

Excel Buffer Table Functions

Prajeesh_NairPrajeesh_Nair Member Posts: 70
edited 2011-06-30 in Navision Attain
Hi guys :) ,

I really want to know more about Excel buffer table in Nav r2. There are plenty of functions defined is there any proper Documentation of the functions (with examples) :-k . Actually I want to insert outer boarder to each cell I am inserting in Excel. I am using the buffer table, for this purpose I was searching the functions in the excel buffer. I think I found the function which will help me –BorderAround(). Can anyone guide me through the usage, initialization of the automation variable? Waiting for your valuable suggestions [-o< .



With Regards
Prajeesh

Comments

  • Options
    Faithie_RobertsonFaithie_Robertson Member Posts: 24
    Prajeesh,

    I moved away from using the excel buffer table and just created a codeunit with various functions that could be called for formatting a cell. Here's the code you're looking for to create a box around a cell:

    xlSheet[SheetNumber].Range(CellRange).Borders.LineStyle := 1;

    Where SheetNumber is an integer of the sheet you're writing to of xlSheet (Worksheet automation type - array of 200 dim's).

    This works like a charm!
    So You Want to be NAV Developer?
    http://www.archerpoint.com/blog/faithie-robertson
    A blog by Faithie Robertson
  • Options
    Prajeesh_NairPrajeesh_Nair Member Posts: 70
    Hi Robertson :) ,

    Thanks for your replay =D> . Please can u make it more elaborate :-k .

    TempExcelBufferRec.INIT;
    TempExcelBufferRec.VALIDATE("Row No.",RowNo);
    TempExcelBufferRec.VALIDATE("Column No.",ColumnNo);
    TempExcelBufferRec."Cell Value as Text" := CellValue;
    TempExcelBufferRec.Formula := '';
    TempExcelBufferRec.Bold := Bold;
    TempExcelBufferRec.Italic := Italic;
    TempExcelBufferRec.Underline := UnderLine;
    xlSheet[SheetNumber].Range(CellRange).Borders.LineStyle := 1;
    TempExcelBufferRec.INSERT;

    I have created a fn Enter Cell in my report which is using Buffer table. Can i add your code in it and get the results. Please give me your valuble advice. Can you send me any Fob's :oops: so that i can go through it and learn more.

    With Regards

    Prajeesh
  • Options
    Prajeesh_NairPrajeesh_Nair Member Posts: 70
    Dear Rober :whistle: ,

    It worked =D> , But i would like to knew is the same possible by using Excel buffer table. I think the appropriate Function is BorderAround :-k . Can u guide to the usage with some Fobs or coded.? :mrgreen:
  • Options
    Faithie_RobertsonFaithie_Robertson Member Posts: 24
    Hi friend,

    Sorry to take so long to respond.

    I'm seeing the "BorderAround" function as:

    XlRange1 := XlWrkSht.Range(RangeName);
    XlRange1.BorderAround(1);


    This looks to be the same thing as what I gave you. The only thing possibly different is that it's not referencing a sheet, so in code you'd have to access the sheet first, and then create the range name, and then execute the border.

    It's always easier for me to just do this through a codeunit I've developed that calls functions to do it all for me. You can access any excel code you want by using the macro record and edit functions within excel to show you the various classes and parms needed. I've simply done that, and made each action into a function. Then each function can be called using parms from one single function that writes the cell contents, formats the data, does borders, colorings, etc...

    I'll send you a sample.

    Blessings!
    FLR
    So You Want to be NAV Developer?
    http://www.archerpoint.com/blog/faithie-robertson
    A blog by Faithie Robertson
Sign In or Register to comment.