Excel Buffer + Formula

taher.bhataher.bha Member Posts: 48
Hi all,
Am trying to export Some data to excel using excel buffer. I cannot find out how to export a formula. Can anyone give me some code lines to do this ?
I already searched Mibuso for this matter, this question was already posted but i can't find any real answer.
To be a little bit clearer am trying to export an invoice line's "unit price" into excel and calculate the LCY price by multiplying the line's unit price by the Header's Currency Factor
Am using the following code to export data as it is :
ExcelBuf.AddColumn("Sales Invoice Line"."Unit Price" ,FALSE,'',TRUE,FALSE,TRUE,''); 
Another solution would be to make Nav do all the job, but i'd like to see Excel in action :)

Comments

  • SavatageSavatage Member Posts: 7,142
    I would probably do it on the fly

    SalesInvHeader.GET("Document No.");
    var_LCYPrice := SalesInvLine."Unit Price" * SalesInvHeader."Currency Factor";
    (or whatever the formula is)

    You are going to have all the info needed to export available already so 1 more calculation isn't such a big deal.

    Then export the var_LCYPrice.
  • XypherXypher Member Posts: 297
    Just as a suggestion since Nav's Excel export method is rather slow when it comes to even small to moderate sized exports. (since they use a Cell by Cell algorithm)

    Check out a little something I have managed to whip up...
    (Sure you may spend a little more time creating some code but the overall efficiency and performance is unequivocal)

    http://www.mibuso.com/forum/viewtopic.php?t=26657


    [One of these days I will create a codeunit with all the user friendly procedures to create a fast Excel export]
  • ricardopaivaricardopaiva Member Posts: 14
    Take a look at report 82 and EnterFormula function.
Sign In or Register to comment.