Показать сообщение отдельно
Старый 09.08.2012, 15:59   #7  
Murlin is offline
Murlin
Возьми свет!!!
Аватар для Murlin
Самостоятельные клиенты AX
Злыдни
 
291 / 32 (2) +++
Регистрация: 22.09.2008
Адрес: Тюмень, Рашан Федерашан
Цитата:
Сообщение от AlexeyVS Посмотреть сообщение
Боюсь в 4ке это не будет работать (
Там используется более прозаический метод закачки файлов:
[/XPP]

Здесь, _name - имя файла без пути
странно метод runReport класса EPDocuGetWebLet
X++:
#define.BUFFER_SIZE(4096)
#File
client static void runReport(Common callerRecord, IISResponse response)
{
    Query                   query = new Query();
    QueryBuildDataSource    qbds;
    QueryRun                queryRun;
    EPSendDocument          document;
    BinData                 binData;
    str                     fileName;
    int                     fileOffset;
    DictTable               table = new DictTable(callerRecord.TableId);
    str                     tempFileName;
    boolean                 emptyReport;
    ;
    if (WebLet::hasTableAccess(callerRecord.TableId))
    {
        qbds = query.addDataSource(callerRecord.TableId);
        if (callerRecord && callerRecord.TableId != tablenum(DocuRef))
        {
            // Requery the record to test record level security
            qbds.addRange(table.fieldName2Id('RecId')).value(SysQuery::value(callerRecord.RecId));
            query.recordLevelSecurity(true);
            queryRun = new QueryRun(query);
            if (queryRun.next())
            {
                document = new EPSendDocument(callerRecord);
                tempFileName = WinAPI::getTempFilename(WinAPI::getTempPath(), 'DAX');
                document.parmOriginal(true);
                document.parmFileName(tempFileName);
                // Make document will run the report and send it to a PDF file with
                // the path specified in tempFileName
                document.makeDocument();
                fileName = document.parmDocumentTitle();
                // remove all ';' from the filename. These are treated as delimiters by Ie
                fileName = strReplace(fileName, ';', '_');
                emptyReport = (WinAPI::fileSize(document.parmFileName()) == 0);
                response.clear();
                response.contentType('application/Octet-Stream');
                binData = new BinData();
                if (emptyReport)
                {
                    response.addHeader('Content-Disposition', 'attachment;filename="' + fileName + #txt + '"');
                    response.writeTxt(strfmt([EMAIL="'@SYS58533'"]'@SYS58533'[/EMAIL], fileName));
                }
                else
                {
                    response.addHeader('Content-Disposition', 'attachment;filename="' + fileName + #pdf + '"');
                    // Loop over the stored file and chunk it down to the client
                    fileOffset = 0;
                    while(true)
                    {
                        // BP Deviation Documented
                        if (!binData.loadFile(tempFileName, fileOffset, #BUFFER_SIZE))
                        {
                            break;
                        }
                        fileOffset += #BUFFER_SIZE;
                        response.binaryWrite(binData.getVariant());
                    }
                }
                binData = null;
                WinAPI::deleteFile(tempFileName);
            }
        }
    }
}
__________________
Axapta 3.0 sp 5 Oracle
Диплом Интернет-Университета Информационных Технологий: Основы бухгалтерского учета
Я могу взорвать вам мозг!!!