private string ExportToCSV() { System.Text.StringBuilder sb = new System.Text.StringBuilder(); int Ax0MemCount = this.Cellset.Axis0TupleMemCount; int Ax1MemCount = this.Cellset.Axis1TupleMemCount; int Ax0PosCount = this.Cellset.Axis0PosCount; int Ax1PosCount = this.Cellset.Axis1PosCount; //-------------------------------- table--------------------------------------- if (Ax0PosCount == 0 && Ax0PosCount == 0) { return("Cellset contains no data"); } for (int i = 0; i < Ax0MemCount; i++) { for (int j = 0; j < Ax1MemCount; j++) { sb.Append("\t"); } for (int j = 0; j < Ax0PosCount; j++) { Olap.CellsetMember mem = this.Cellset.GetCellsetMember(0, i, j); sb.Append(mem.Name); sb.Append("\t"); } sb.Append("\r\n"); } for (int i = 0; i < Ax1PosCount; i++) { for (int j = 0; j < Ax1MemCount; j++) { Olap.CellsetMember mem = this.Cellset.GetCellsetMember(1, j, i); sb.Append(mem.Name); sb.Append("\t"); } for (int j = 0; j < Ax0PosCount; j++) { Olap.Cell olapCell = this.Cellset.GetCell(j, i); sb.Append(olapCell.FormattedValue); sb.Append("\t"); } sb.Append("\r\n"); } return(sb.ToString()); }
private string ExportToHTML() { System.Text.StringBuilder sb = new System.Text.StringBuilder(); // XSL DOC string xsl = this.Xsl; xsl = xsl.Replace("<!--@NAME-->", this.Name); xsl = xsl.Replace("<!--@DESCRIPTION-->", this.Description); xsl = xsl.Replace("<!--@OWNER-->", this.Owner.Name); xsl = xsl.Replace("<!--@TIME-->", System.DateTime.Now.ToShortDateString() + " " + System.DateTime.Now.ToShortTimeString()); sb.Append(xsl); sb.Append(@"<XML ID=""xmlDoc"">"); sb.Append(@"<cellset>"); int Ax0MemCount = _cellset.Axis0TupleMemCount; int Ax1MemCount = _cellset.Axis1TupleMemCount; int Ax0PosCount = _cellset.Axis0PosCount; int Ax1PosCount = _cellset.Axis1PosCount; for (int i = 0; i < Ax0MemCount; i++) { sb.Append("<row ord='" + i.ToString() + "' head='1' "); // empty rows in beginning for (int j = 0; j < Ax1MemCount; j++) { sb.Append("ce" + j.ToString() + "='' "); } // column captions for (int n = 0; n < Ax0PosCount; n++) { string memCaption = _cellset.GetCellsetMember(0, i, n).Name; sb.Append("ch" + (n + Ax1MemCount).ToString() + @"=""" + System.Web.HttpUtility.HtmlEncode(memCaption) + @""" "); } sb.Append(" />"); } for (int i = 0; i < Ax1PosCount; i++) { sb.Append("<row ord='" + (Ax0MemCount + i).ToString() + "' head='0' "); // row captions for (int j = 0; j < Ax1MemCount; j++) { string memCaption = _cellset.GetCellsetMember(1, j, i).Name; sb.Append("ch" + j.ToString() + @"=""" + System.Web.HttpUtility.HtmlEncode(memCaption) + @""" "); } // cells for (int n = 0; n < Ax0PosCount; n++) { Olap.Cell cell = _cellset.GetCell(n, i); sb.Append("c" + (n + Ax1MemCount).ToString() + @"=""" + cell.FormattedValue + @""" "); } sb.Append(" />"); } sb.Append(@"</cellset>"); sb.Append("</XML>"); return(sb.ToString()); }