AXForum  
Вернуться   AXForum > Microsoft Dynamics AX > DAX Blogs
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 29.05.2010, 03:18   #1  
Blog bot is offline
Blog bot
Участник
 
25,497 / 847 (79) +++++++
Регистрация: 28.10.2006
emeadaxsupport: Cost accounting journal excel import dialog fails to appear COSExcelImport
Источник: http://blogs.msdn.com/b/emeadaxsuppo...celimport.aspx
==============

This week I have been investgating an issue with the Excel import in Cost Accounting->CostTransactions->Import button.

When I click the import button the Excel import wizard comes up, I click next, then I click "Open workbook". At this point I expect to see an Excel "open file" dialog box, but I don't get one, nothing appears to happen. However if I press alt+tab I find that the dialog box is there in the background it was just that it didn't get focus when it opened, so I can find my Excel file and carry on with the import.

It is possible to allow the Excel dialog to gain focus automatically with a small code change in Classes\COSExcelImport.

X++:
public boolean openWorkBook()
{
    #COSStrings

    COMVariant      fileName;
    COMVariant      fileFilter;
    int             infoLine    = infolog.line();
    ;

    fileName    = new COMVariant();
    fileFilter  = new COMVariant();
    fileFilter.bStr("@SYS28576" + ' ' + '(*.xls; *.xlsx), *.xls; *.xlsx');

    try
    {
        WinAPI::setForegroundWindow(WinAPI::findWindow('', 'Microsoft Excel')); //NEWLINE

        fileName = application.getOpenFileName(fileFilter);

        if (!fileName.boolean())
        {
            // Cancel button was selected.
            info("@SYS59931");
            return false;
        }
        else
        {
            workBooks = application.workBooks();
            workBooks.open(fileName);
            workSheets  = application.worksheets(); //Get access to the collection of worksheets
        }
    }
    catch (Exception::Error)
    {
        infolog.clear(infoLine);
        throw error("@SYS59929");
    }

    application.visible (false);
    return true;
}
To explain why I chose this particular type of fix - because I also explored other possibilities - such as starting a timed method which will set focus directly to the open file dialog once it is opened (as when the dialog is opened code stops running), using infolog.addTimeOut(). However I found that even a timed method started before opening the dialog will not run once the dialog is opened until the dialog is closed. I also explored the idea of using a method of Excel.Application to set focus to the dialog, but it appears there isn't a function/method available to do this as standard.

This issue only occurs with Windows 2008 R2 and Windows 7. It occurs in AX4 and AX2009. It has been officially registered with Microsoft and will currently be dealt with in a future version/service pack, of course we will re-evaluate that status if we find a company that is significantly impacted by it.




Источник: http://blogs.msdn.com/b/emeadaxsuppo...celimport.aspx
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
emeadaxsupport: Project module Excel pivot table fails with error 0x80070057 E_INVALIDARG Blog bot DAX Blogs 0 10.05.2010 21:05
emeadaxsupport: Export to Excel can fail on a Windows Terminal Server Blog bot DAX Blogs 0 27.01.2010 13:05
hariprasadp: Import Excel file data in to dynamics AX through Dynamics AX Blog bot DAX Blogs 0 17.12.2009 20:05
emeadaxsupport: How does the Export to Excel feature work under the hood? Blog bot DAX Blogs 0 07.09.2009 19:05
Arijit Basu: Excel Import | Custom Blog bot DAX Blogs 5 12.04.2007 13:48

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 01:15.
Powered by vBulletin® v3.8.5. Перевод: zCarot
Контактная информация, Реклама.