Options

Export excel through NAS in NAV 2013 R2

snupysnupy Member Posts: 11
Please help!

I want to upload the data to a file excel template through NAS, but an error in XlHelper.CallOpen(XlAppRTC,FileName). (all dotnet RunOnClient = no)

Message: Cannot create an instance of the following .NET Framework: сборка Microsoft.Dynamics.Nav.Integration.Office, Version=7.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, тип Microsoft.Dynamics.Nav.Integration.Office.Excel.ExcelHelper.

Type: System.IO.FileNotFoundException
Message: Could not load file or assembly 'Microsoft.Dynamics.Nav.Integration.Office, Version=7.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
FileName: Microsoft.Dynamics.Nav.Integration.Office, Version=7.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
FusionLog:


c al code

IF FileName = '' THEN
ERROR(EmptyFileNameErr);

XlAppRTC := XlAppRTC.ApplicationClass;
IF ISNULL(XlAppRTC) THEN
ERROR(ExcelNotFoundErr);

XlHelper.CallOpen(XlAppRTC,FileName);
XlWrkBkRTC := XlAppRTC.ActiveWorkbook;

What could be the reason?

Best Answer

Answers

  • Options
    mohana_cse06mohana_cse06 Member Posts: 5,503
    it seems system is not able to find the file.
    please check with EXIST function before whether file is existing or not.
  • Options
    snupysnupy Member Posts: 11
    H
    it seems system is not able to find the file.
    please check with EXIST function before whether file is existing or not.

    Hello,

    I wrote this

    IF FileName = '' THEN
    ERROR(EmptyFileNameErr);

    XlAppRTC := XlAppRTC.ApplicationClass;
    IF ISNULL(XlAppRTC) THEN
    ERROR(ExcelNotFoundErr);

    IF NOT EXISTS(FileName) THEN
    ERROR(ExcelNotFoundErr);

    XlHelper.CallOpen(XlAppRTC,FileName);
    XlWrkBkRTC := XlAppRTC.ActiveWorkbook;

    error persists :(


    1.jpg 258.8K
    2.jpg 458.5K
  • Options
    snupysnupy Member Posts: 11
    Help!
  • Options
    KishormKishorm Member Posts: 921
    have you seen this blog post by Saurav?...

    Microsoft Dynamics NAV 2016 - Save Export To Excel With NAS!

    ...I know it says 2016 but you should be able to use/tweak it for 2013 R2
  • Options
    kylehardinkylehardin Member Posts: 257
    If you are going to run all of the DotNet on the Service Tier, then Excel has to be installed on the service tier. I'd say switch the DotNet controls to run on the client and see if that fixes your problem.

    EXIST will only run on the NST system.
    Kyle Hardin - ArcherPoint
  • Options
    snupysnupy Member Posts: 11
    Kishorm wrote: »
    have you seen this blog post by Saurav?...

    Microsoft Dynamics NAV 2016 - Save Export To Excel With NAS!

    ...I know it says 2016 but you should be able to use/tweak it for 2013 R2

    Hello Kishorm,

    I have another case. I need to Export the data in the template Excel. This template is written macro.

    FileName := 'C:\log\1\Template File Name';

    ExcelBuf.OpenBook_NAS2(FileName);
    ExcelBuf.OpenSheet_NAS2("Template Sheet Name");
    ExcelBuf.CreateSheetNoFormat_NAS2("Template Sheet Name");
    ExcelBuf.GiveUserControlNASRTC3;


    OpenBook_NAS2(FileName : Text[250])
    IF FileName = '' THEN
    ERROR(EmptyFileNameErr);

    XlAppRTC := XlAppRTC.ApplicationClass;
    IF ISNULL(XlAppRTC) THEN
    ERROR(ExcelNotFoundErr);

    IF NOT EXISTS(FileName) THEN
    ERROR(ExcelNotFoundErr);

    // Here is the error
    XlHelper.CallOpen(XlAppRTC,FileName);
    //


    XlWrkBkRTC := XlAppRTC.ActiveWorkbook;

  • Options
    snupysnupy Member Posts: 11
    kylehardin wrote: »
    If you are going to run all of the DotNet on the Service Tier, then Excel has to be installed on the service tier. I'd say switch the DotNet controls to run on the client and see if that fixes your problem.

    EXIST will only run on the NST system.

    Hello,

    Exell (office 16) installed on Server Navision and on Client. IF DotNet = yes and running on clent, it work very good.
  • Options
    snupysnupy Member Posts: 11
    Kishorm wrote: »
    Are you sure that the Microsoft.Dynamics.NAV.Integration.Office.DLL has been installed correctly on the server?

    This should be under C:\Program Files\Microsoft Dynamics NAV\xx\Service\Add-ins\Office if the install was does to the default folders.

    Kishorm, you are a genius

    Folder Office was C:\Program Files (x86)\Microsoft Dynamics NAV\71\RoleTailored Client\Add-ins\Office. I moved C:\Program Files\Microsoft Dynamics NAV\xx\Service\Add-ins\Office and it's worked!

    Thank you
  • Options
    snupysnupy Member Posts: 11
    Kishorm wrote: »
    Are you sure that the Microsoft.Dynamics.NAV.Integration.Office.DLL has been installed correctly on the server?

    This should be under C:\Program Files\Microsoft Dynamics NAV\xx\Service\Add-ins\Office if the install was does to the default folders.

    Hi Everyone,

    Can you please!

    What am I doing wrong?

    Now, an error in the function ExcelBuf.OpenSheet_NAS2("Template Sheet Name");

    OpenSheet_NAS2(SheetName : Text[30])
    i := 1;
    EndOfLoop := XlWrkBkRTC.Worksheets.Count;
    ERROR
    A call to System.__ComObject.get_Count failed with this message: The type of one or more arguments does not match the method's parameter type.


    WHILE (i <= EndOfLoop) AND (NOT Found) DO BEGIN
    XlWrkShtRTC := XlWrkBkRTC.Worksheets.Item(i);
    ERROR
    A call to System.__ComObject.get_Item failed with this message: The type of one or more arguments does not match the method's parameter type.

    IF SheetName = XlWrkShtRTC.Name THEN
    Found := TRUE;
    i := i + 1;
    END;
    IF Found THEN
    XlWrkShtRTC := XlWrkBkRTC.Worksheets.Item(SheetName)
    ELSE
    ErrorExcelProcessing(STRSUBSTNO(WorksheetNotFoundErr,SheetName));

    Help me, please!!!
Sign In or Register to comment.