using System; using System.Collections.Generic; using System.IO; using System.Text; namespace BeWo.Service.Core { [Serializable] public class ExcelDownload { private string[][] _Content; private string[] _Header; public ExcelDownload(string[] pHeader, string[][] pContent) { this._Header = pHeader; this._Content = pContent; } public ExcelDownload() { } public string[][] Content { get { return this._Content; } set { this._Content = value; } } public string[] Header { get { return this._Header; } set { this._Header = value; } } public string CreateExcelOutputString() { var lSb = new StringBuilder(); lSb.Append(""); lSb.Append(""); lSb.Append(""); lSb.Append(""); lSb.Append(""); lSb.Append(""); lSb.Append(""); lSb.Append(""); lSb.Append(""); Dictionary ignoreIndices = new Dictionary(); int index = 0; foreach (string iHeader in _Header) { if (iHeader == "OID") { ignoreIndices.Add(index, true); } else { lSb.Append(""); } index++; } lSb.Append(""); foreach (var t in _Content) { lSb.Append(""); index = 0; foreach (var t1 in t) { if (!ignoreIndices.ContainsKey(index)) { lSb.Append(""); } index ++; } lSb.Append(""); } lSb.Append("
"); lSb.Append(iHeader); lSb.Append("
"); lSb.Append(t1); lSb.Append("
"); lSb.Append(""); lSb.Append(""); return lSb.ToString(); } } }