public byte[] GetZip()
        {
            if (!GetXaml())
            {
                return(null);
            }

            MemoryStream ms = new MemoryStream();

            _ZipStream = null;

            ZipEntry ze;

            try
            {
                ZipWrap.Init();             // initialize the zipping utility (if needed)
                _ZipImages = new Dictionary <string, string>();

                _ZipStream = new ZipOutputStream(ms);

                // Need to build the Xaml
                int pageno = 1;
                foreach (fyiReporting.RDL.Page page in _Pages)
                {
                    string xaml = GenerateXaml(page);
                    string zp   = string.Format("pg_{0}.xaml", pageno++);
                    ze = new ZipEntry(zp);
                    _ZipStream.PutNextEntry(ze);
                    _ZipStream.Write(xaml);
                }
                // output some meta data
                ze = new ZipEntry("meta.txt");
                _ZipStream.PutNextEntry(ze);
                _ZipStream.Write(string.Format("pagecount={0}", _Pages.Count)); // to do more than one use & e.g. pagecount=1&pagewidth=121

                // all done
                _ZipStream.Finish();
                _ZipStream = null;
                return(ms.ToArray());
            }
            finally
            {
                if (_ZipStream != null)
                {
                    _ZipStream.Finish();
                    _ZipStream = null;
                }
                ms.Close();
                _ZipImages = null;              // no longer need zipimage cache
            }
        }
        StyleInfo _DefaultStyle;                                // Default styles

        internal ExcelValet()
        {
            _Sheets      = new List <SheetInfo>();
            _Grid        = null;
            _StringCache = new StringCache();
            _BorderCache = new StringCache();
            _FontCache   = new StringCache();
            _FillCache   = new StringCache();
            // work around so that the first 2 fill caches matches what Excel chooses for them
            _FillCache.GetIndex("<fill><patternFill patternType=\"none\"/></fill>");    //index 0
            _FillCache.GetIndex("<fill><patternFill patternType=\"gray125\"/></fill>"); //index 1

            //AJM GJL 130608 - Merge Cells
            _MergeCells = new StringCache();

            _StyleCache    = new StringCache();
            _StyleXfsCache = new StringCache();
            _DefaultStyle  = new StyleInfo();                   // use this when no style is specified

            GetStyleIndex(_DefaultStyle);                       // populates the default style entries as 0
            ZipWrap.Init();                                     // intialize the zip utility (doesn't hurt to do if already done)
        }