Beispiel #1
0
        private void DoOutFile(string strFileName)
        {
            ArrayList files = new ArrayList();

            for (int i = 0; i < this.TotalNum; i++)
            {
                int num2 = 0;
                int num3 = 0;
                int num4 = 0;
                if ((i >= (this.StartNum - 1)) && (i <= (this.EndNum - 1)))
                {
                    num4++;
                    if (i == 0)
                    {
                        num2 = i * this.showNum;
                    }
                    else
                    {
                        num2 = (i * this.showNum) + 1;
                    }
                    num3 = (i + 1) * this.showNum;
                    if (ResFunc.IsOnlineOutRes(this.curFolder.ClassOid))
                    {
                        ResFunc.GetNumDS(out this.theDataSet, this.curFolder, this.attrList, num2, num3, this.strSort);
                        ResFunc.ConvertOuterDSHead(this.theDataSet, this.attrList, this.attrOuter);
                    }
                    else if (ResFunc.IsRefRes(this.curFolder.ClassOid))
                    {
                        PLSPL       plspl  = new PLSPL();
                        DEMetaClass class2 = ModelContext.MetaModel.GetClass(this.curFolder.ClassOid);
                        DEMetaClass class3 = ModelContext.MetaModel.GetClass(class2.RefClass);
                        this.clsName = class3.Name;
                        ArrayList attrList = new ArrayList();
                        foreach (DEMetaAttribute attribute in this.attrList)
                        {
                            if (this.ISDefAttrViewable(attribute))
                            {
                                attrList.Add(attribute);
                            }
                        }
                        this.theDataSet = plspl.GetSPLNumDataSet(class3.Name, attrList, ClientData.LogonUser.Oid, num2, num3, this.curFolder.FilterString, this.curFolder.FilterValue, this.strSort);
                        this.b_refType  = true;
                    }
                    else if (ResFunc.IsTabRes(this.curFolder.ClassOid))
                    {
                        new ArrayList();
                        ResFunc.GetNumDS(out this.theDataSet, this.curFolder, this.attrList, num2, num3, this.strSort);
                    }
                    if (this.theDataSet != null)
                    {
                        if (num4 == 1)
                        {
                            this.InitLvShowHeader();
                        }
                        this.ConvertToListView();
                        if (this.IsMultiPageOut)
                        {
                            string str = Path.Combine(this.tmpPath, "page" + ((i + 1)).ToString());
                            this.ToXlsFile(this.lvw, str, "page" + ((i + 1)).ToString());
                            files.Add(str);
                        }
                    }
                }
            }
            if (!this.IsMultiPageOut)
            {
                string str2 = Path.Combine(this.tmpPath, "page1");
                this.ToXlsFile(this.lvw, str2, "page1");
                files.Add(str2);
            }
            if (files.Count > 0)
            {
                try
                {
                    this.excelPipe.UnionBooks(files);
                    this.excelPipe.RemoveWorkSheet(1);
                }
                catch (Exception exception)
                {
                    MessageBoxPLM.Show(exception.Message);
                }
                finally
                {
                    try
                    {
                        this.excelPipe.QuitAll(strFileName);
                    }
                    catch (Exception exception2)
                    {
                        MessageBoxPLM.Show(exception2.Message);
                    }
                }
            }
        }