Esempio n. 1
0
        public static byte[] ExportOpmlRSS(string dataOPML, ExportToFormat exportFormat,
                                           params KeyValuePair <string, object>[] additionalData)
        {
            if (exportFormat != ExportToFormat.Excel2007)
            {
                throw new ArgumentException("ready just for Excel 2007");
            }

            XDocument rssDoc;

            if (Uri.IsWellFormedUriString(dataOPML, UriKind.Absolute))
            {
                rssDoc = XDocument.Load(dataOPML);
            }
            else
            {
                rssDoc = XDocument.Parse(dataOPML);
            }

            var dataNodes = rssDoc.XPathSelectElements("//outline[@type='rss']").ToArray();
            var count     = dataNodes.Length;
            var listData  = new List <IList>(count);

            for (int i = 0; i < count; i++)
            {
                var rss       = dataNodes[i].Attribute("xmlUrl").Value;
                var jsonArray = ExportFactory.GetDataFromRSS(rss);
                listData.Add(FromJson(jsonArray));
            }
            var export = new ExportExcel2007 <Tuple <string> >();
            var data   = export.ExportMultipleSheets(listData.ToArray(), additionalData);

            return(data);
        }
Esempio n. 2
0
        public static byte[] ExportDataSet(DataSet ds, ExportToFormat exportFormat,
                                           params KeyValuePair <string, object>[] additionalData)
        {
            if (exportFormat != ExportToFormat.Excel2007)
            {
                throw new ArgumentException("ready just for Excel 2007");
            }

            var export = new ExportExcel2007 <Tuple <string> >();

            return(export.ExportMultipleSheets(ds));
        }