zoukankan      html  css  js  c++  java
  • 导出CSV

    static void ExInventMaterialType(Args _args)

    {

        InventTable                         _invent;

        #AviFiles

        str                                 s,tempStr;

        int                                 i,RecCount;

        container                           c,conFilter = ["Excel Files(*.csv)", "*.csv"];

        SysOperationProgress                simpleProgress;

        TextBuffer                          textBuffer  = new TextBuffer();

        FileIoPermission                    perm;

        counter                             Lines;

        ;

        s = Winapi::getSaveFileName(0, conFilter, "","Save File", "", "");

        if (s)

        {

            select count(RecId) from _invent  where _invent.NJ_MaterialType != "";

            RecCount = _invent.RecId;

            simpleProgress = SysOperationProgress::newGeneral(#aviUpdate, 'Exporting...', RecCount);

            simpleProgress.setCaption("Data Export");

            simpleProgress.setAnimation(#AviFormLetter);

            startlengthyoperation();

            try

            {

                perm = new FileIoPermission(s, "w");

                perm.assert();

                textBuffer.appendText("Itemid,");

                textBuffer.appendText("MaterialType,");

                textBuffer.appendText("\n");

                while select _invent where _invent.NJ_MaterialType != ""

                {

                    //if (StrLen())

     

                    //textBuffer.appendText(strReplace(strfmt("%1,",NJ_Search_Inventory.tagBL),"\n"," "));

                    textBuffer.appendText(strfmt("%1,",_invent.ItemId));

                    textBuffer.appendText(strfmt("%1,",_invent.NJ_MaterialType));

                    /* textBuffer.appendText(strfmt("%1,",NJ_Search_Inventory.ACT_ItemCategoryId));

                    textBuffer.appendText(strfmt("%1,",NJ_Search_Inventory.ACT_ProdShapeID)); */

                    textBuffer.appendText("\n");

                    simpleProgress.incCount();

                    simpleprogress.setText(strfmt("Task: %1/%2", i,RecCount));

                    i++;

                }

                Lines = textBuffer.numLines();

                try

                {

                    if (textBuffer.toFile(s))

                        info(strfmt("¼Ç¼µ¼³öµ½Îļþ %1.¹²µ¼³öÁË %2 ÐмǼ.",s,Lines-1));

                }

                catch ( Exception::Error )

                {

                    error ("Generated file error.");

                }

                CodeAccessPermission::revertAssert();

                }

               

            catch (Exception::Deadlock)

            {

                retry;

            }

        }

    }

  • 相关阅读:
    X-010 FriendlyARM tiny4412 uboot移植之移植网卡驱动TFTP用起来
    使用NFS启动Tiny4412开发板根文件系统
    《C专家编程》第四章——令人震惊的事实:数组和指针并不相同
    《C专家编程》第三章——分析C语言的声明
    《C专家编程》第二章——这不是Bug,而是语言特性
    《C专家编程》第一章——C:穿越时空的迷雾
    《C与指针》读后感
    《C与指针》第十五章练习
    《C与指针》第十四章练习
    《C与指针》第十三章练习
  • 原文地址:https://www.cnblogs.com/perock/p/2182257.html
Copyright © 2011-2022 走看看