public static void SetTable(ISlide sld, System.Data.DataTable dt, int index, Office_ChartStyle style, int?xsts) { ITable table = (ITable)sld.Shapes[index]; foreach (System.Data.DataRow item in dt.Rows) { IRow row = table.Rows[1]; for (int i = 0; i < dt.Columns.Count; i++) { row[i].TextFrame.Text = item[i].ToString(); } table.Rows.AddClone(row, false); } table.Rows.RemoveAt(1, false); }
public static void SetChart(ISlide sld, System.Data.DataTable dt, int index, Office_ChartStyle style, int?xsts) { ITable chart = (ITable)sld.Shapes[index]; for (int i = 0; i < chart.Columns.Count; i++) { if (dt != null && dt.Rows.Count > 0) { for (int j = 0; j < (xsts.HasValue ? xsts : dt.Rows.Count); j++) { chart.Columns[i][j + 1].TextFrame.Text = dt.Rows[j][i].ToString(); } } } }
/// <summary> /// 生成单列图表 /// </summary> /// <param name="sld">当前ppt页面</param> /// <param name="dt">数据</param> /// <param name="index">图表所属表格排序(当前slide)</param> public static void SingleAxexchart(ISlide sld, System.Data.DataTable dt, int index, Office_ChartStyle style) { IChart chart = (IChart)sld.Shapes[index]; string range = "Sheet1!$A$1:$" + Base_ColumnsHelper.GET_INDEX(dt.Columns.Count) + "$" + (dt.Rows.Count + 1); //实例化图表数据表 IChartDataWorkbook fact = chart.ChartData.ChartDataWorkbook; chart.ChartData.ChartDataWorkbook.Clear(0); Workbook workbook = Office_TableToWork.GetWorkBooxFromDataTable(dt); MemoryStream mem = new MemoryStream(); workbook.Save(mem, Aspose.Cells.SaveFormat.Xlsx); chart.ChartData.WriteWorkbookStream(mem); //设置数据区域 chart.ChartData.SetRange(range); //交换横纵坐标 if (style.坐标方向 == Base_Config.坐标方向.横向) { chart.ChartData.SwitchRowColumn(); } IChartSeries series = chart.ChartData.Series[0]; series.Labels.DefaultDataLabelFormat.ShowValue = style.是否显示文字; series.Labels.DefaultDataLabelFormat.Position = style.文字位置; series.Labels.DefaultDataLabelFormat.TextFormat.TextBlockFormat.TextVerticalType = style.文字旋转方向; }
public static void SetJP_JINKESHICHANGZHOUBAO_2_Table(ISlide sld, System.Data.DataTable dt, int index, Office_ChartStyle style, int?xsts) { ITable table = (ITable)sld.Shapes[index]; table.Rows[0][3].TextFrame.Text = Base_date.GET_ZCMC(Base_date.bn, Base_date.bz); table.Rows[0][7].TextFrame.Text = Base_date.GET_ZCMC(Base_date.bn, Base_date.bz); foreach (System.Data.DataRow item in dt.Rows) { IRow row = table.Rows[2]; for (int i = 0; i < dt.Columns.Count; i++) { row[i].TextFrame.Text = item[i].ToString(); } table.Rows.AddClone(row, false); } table.Rows.RemoveAt(2, false); }
public static void SetJP_QIDIXIEXIN_1_Table(ISlide sld, System.Data.DataTable dt, int index, Office_ChartStyle style, int?xsts) { ITable table = (ITable)sld.Shapes[index]; table.Rows[0][2].TextFrame.Text = string.Format("{0}(认购)", Base_date.GET_ZCMC(Base_date.bn, Base_date.bz - 1)); table.Rows[0][6].TextFrame.Text = string.Format("{0}(认购)", Base_date.GET_ZCMC(Base_date.bn, Base_date.bz)); foreach (System.Data.DataRow item in dt.Rows) { IRow row = table.Rows[2]; for (int i = 0; i < dt.Columns.Count; i++) { row[i].TextFrame.Text = item[i].ToString(); } table.Rows.AddClone(row, false); } table.Rows.RemoveAt(2, false); }
public static void SetJP_JINHUIJIANBAO_Table(ISlide sld, System.Data.DataTable dt, int index, Office_ChartStyle style, int?xsts) { ITable table = (ITable)sld.Shapes[index]; table.Rows[1][2].TextFrame.Text = Base_date.GET_ZCMC(Base_date.bn, Base_date.bz - 3); table.Rows[1][4].TextFrame.Text = Base_date.GET_ZCMC(Base_date.bn, Base_date.bz - 2); table.Rows[1][6].TextFrame.Text = Base_date.GET_ZCMC(Base_date.bn, Base_date.bz - 1); table.Rows[1][8].TextFrame.Text = Base_date.GET_ZCMC(Base_date.bn, Base_date.bz); foreach (System.Data.DataRow item in dt.Rows) { IRow row = table.Rows[3]; for (int i = 0; i < dt.Columns.Count; i++) { row[i].TextFrame.Text = item[i].ToString(); } table.Rows.AddClone(row, false); } table.Rows.RemoveAt(3, false); }
public static void SetJP_CHONGQINGSHICHANGYINGXIAOBU_Table(ISlide sld, System.Data.DataTable dt, int index, Office_ChartStyle style, int?xsts) { ITable table = (ITable)sld.Shapes[index]; table.Rows[1][3].TextFrame.Text = Base_date.GET_ZCMC(Base_date.bn, Base_date.bz - 3); table.Rows[1][5].TextFrame.Text = Base_date.GET_ZCMC(Base_date.bn, Base_date.bz - 2); table.Rows[1][7].TextFrame.Text = Base_date.GET_ZCMC(Base_date.bn, Base_date.bz - 1); table.Rows[1][9].TextFrame.Text = Base_date.GET_ZCMC(Base_date.bn, Base_date.bz); table.Rows[1][11].TextFrame.Text = string.Format("{0}月备案", Base_date.sy_First.Month); foreach (System.Data.DataRow item in dt.Rows) { IRow row = table.Rows[3]; for (int i = 0; i < dt.Columns.Count; i++) { row[i].TextFrame.Text = item[i].ToString(); } table.Rows.AddClone(row, false); } table.Rows.RemoveAt(3, false); }
public static void SetJP_XIANGYU_JINGPINGBEIAN_Table(ISlide sld, System.Data.DataTable dt, int index, Office_ChartStyle style, int?xsts) { ITable table = (ITable)sld.Shapes[index]; table.Rows[1][2].TextFrame.Text = string.Format("备案套数({0})", Base_date.GET_ZCMC(Base_date.bn, Base_date.bz)); table.Rows[1][10].TextFrame.Text = string.Format("备案套数({0})", Base_date.GET_ZCMC(Base_date.bn, Base_date.bz - 1)); table.Rows[1][14].TextFrame.Text = string.Format("累计套数({0})", Base_date.GET_NFYFMC(Base_date.by_First, Base_date.bz_Last)); table.Rows[1][18].TextFrame.Text = string.Format("累计套数({0})", "1.1-" + Base_date.bz_Last.ToString("M.d")); foreach (System.Data.DataRow item in dt.Rows) { IRow row = table.Rows[2]; for (int i = 0; i < dt.Columns.Count; i++) { row[i].TextFrame.Text = item[i].ToString(); } table.Rows.AddClone(row, false); } table.Rows.RemoveAt(2, false); }
public static void SetJP_JINGDIDICHAN_PT_Table(ISlide sld, System.Data.DataTable dt, int index, Office_ChartStyle style, int?xsts) { ITable table = (ITable)sld.Shapes[index]; table.Rows[1][2].TextFrame.Text = Base_date.GET_ZCMC(Base_date.bn, Base_date.bz - 3); table.Rows[1][6].TextFrame.Text = Base_date.GET_ZCMC(Base_date.bn, Base_date.bz - 2); table.Rows[1][8].TextFrame.Text = Base_date.GET_ZCMC(Base_date.bn, Base_date.bz - 1); table.Rows[1][10].TextFrame.Text = Base_date.GET_ZCMC(Base_date.bn, Base_date.bz); table.Rows[1][12].TextFrame.Text = string.Format("{0}月备案({1})", Base_date.sy_First.Month, Base_date.GET_NFYFMC(Base_date.bn, Base_date.sy_First.Month)); foreach (System.Data.DataRow item in dt.Rows) { IRow row = table.Rows[3]; for (int i = 0; i < dt.Columns.Count; i++) { row[i].TextFrame.Text = item[i].ToString(); } table.Rows.AddClone(row, false); } table.Rows.RemoveAt(3, false); }
public static void SetJP_ZeKe_JPBX_Table(ISlide sld, System.Data.DataTable dt, int index, Office_ChartStyle style, int?xsts, string yt) { ITable table = (ITable)sld.Shapes[index]; if (yt == "商铺") { table.Rows[0][6].TextFrame.Text = Base_date.GET_ZCMC(Base_date.bn, Base_date.bz - 1); table.Rows[0][9].TextFrame.Text = Base_date.GET_ZCMC(Base_date.bn, Base_date.bz); foreach (System.Data.DataRow item in dt.Rows) { IRow row = table.Rows[2]; for (int i = 0; i < dt.Columns.Count; i++) { row[i].TextFrame.Text = item[i].ToString(); } table.Rows.AddClone(row, false); } table.Rows.RemoveAt(2, false); } else { table.Rows[0][6].TextFrame.Text = Base_date.GET_ZCMC(Base_date.bn, Base_date.bz - 1); table.Rows[0][12].TextFrame.Text = Base_date.GET_ZCMC(Base_date.bn, Base_date.bz); foreach (System.Data.DataRow item in dt.Rows) { IRow row = table.Rows[3]; for (int i = 0; i < dt.Columns.Count; i++) { row[i].TextFrame.Text = item[i].ToString(); } table.Rows.AddClone(row, false); } table.Rows.RemoveAt(3, false); } }
public static void SetJP_HuaQiaoCheng_Table(ISlide sld, System.Data.DataTable dt, int index, Office_ChartStyle style, int?xsts) { ITable table = (ITable)sld.Shapes[index]; table.Rows[0][6].TextFrame.Text = Base_date.GET_ZCMC(Base_date.bn, Base_date.bz - 1); table.Rows[0][10].TextFrame.Text = Base_date.GET_ZCMC(Base_date.bn, Base_date.bz); foreach (System.Data.DataRow item in dt.Rows) { IRow row = table.Rows[2]; for (int i = 0; i < dt.Columns.Count; i++) { row[i].TextFrame.Text = item[i].ToString(); } table.Rows.AddClone(row, false); } table.Rows.RemoveAt(2, false); //for (int i = 0; i < chart.Columns.Count; i++) //{ // if (dt != null && dt.Rows.Count > 0) // { // for (int j = 0; j < (xsts.HasValue ? xsts : dt.Rows.Count); j++) // { // chart.Columns[i][j + 3].TextFrame.Text = dt.Rows[j][i].ToString(); // //chart.Rows[i] // } // } //} }