抖音资讯

douyinzx

word插件开发支持哪些语言(word开发工具属性)

iseeyu2年前 (2024-05-08)抖音资讯110

1, 在excel里面多个柱状图会重叠在图表里面,这是因为多个柱状图不重叠的话type要设置成Orig.ChartType =
XlChartType.xlColumnClustered;; 重叠的话,Orig.ChartType = XlChartType.xlColumnStacked;

2 关于图例:如果设置position 的话,图例会横向排列,不设置

// chart.Legend.Position =
Excel.XlLegendPosition.xlLegendPositionTop; 图例会竖着排列

chart.Legend.Left = 80;

chart.Legend.Height = 15* list.Count();

chart.Legend.IncludeInLayout = true;

chart.Legend.Top = 0;

chart.Legend.Width = 150;

// chart.Legend.Position = Excel.XlLegendPosition.xlLegendPositionTop;

chart.Legend.Font.Color = ColorTranslator.ToOle(Color.Black);

3 xAxis.MinorTickMark =
Excel.XlTickMark.xlTickMarkOutside;坐标轴刻度


xAxis.TickLabels.NumberFormat = "yyyy-mm-dd"; 坐标轴时间设置

4 调用
Microsoft.Office.Interop.Excel.Shape myChart = newWorksheet.Shapes.AddChart2(-1, XlChartType.xlLine, 250, 50, width, 165, true); 会在图表默认生成一条空数据的图形,要删除

Excel.SeriesCollection seriescollectionB2 = chart.SeriesCollection();

int cc = seriescollectionB2.Count;

seriescollectionB2.Item(1).Delete();

 

#function

public static Microsoft.Office.Interop.Excel.Shape GetChart(Excel.Application eApp,Document document, WordCharItem onechartData, ContentControl c, int width)

{

Excel.Worksheet newWorksheet = eApp.Worksheets.Add();//获取第一个Worksheet

//newWorksheet.Activate();

//向表格中插入数据

string[,] array = ExtractHelper.GetKeppArray(onechartData.chartIndexDataList);

var list = onechartData.chartIndexList.OrderBy(p => p.axisType);

int indexcount = list.Count();

int rowIndex = 0;

int columnIndex = 1;

int columnlength1 = onechartData.chartIndexDataList[0].Split(ExtractHelper.splitchar).Length;

int headerCount = 1;

int lenght = onechartData.chartIndexDataList.Length - headerCount;

int rowlenght = onechartData.chartIndexDataList.Length - 1;

Microsoft.Office.Interop.Excel.Range c1 = newWorksheet.Cells[rowIndex + 1, columnIndex];

Microsoft.Office.Interop.Excel.Range c3 = newWorksheet.Cells[rowIndex + rowlenght, columnlength1];

Microsoft.Office.Interop.Excel.Range range3 = newWorksheet.Range[c1, c3];

range3.Value2 = array;

//range3.NumberFormat= numberFormat;

int SeriesCount = onechartData.chartIndexList.Count();

Microsoft.Office.Interop.Excel.Range timeStartRange = newWorksheet.Cells[1, 1];

Microsoft.Office.Interop.Excel.Range timeEndRange = newWorksheet.Cells[rowlenght, 1]; ;

Microsoft.Office.Interop.Excel.Range XValues = newWorksheet.Range[timeStartRange, timeEndRange];

XValues.NumberFormat = "yyyy/m/d";

Microsoft.Office.Interop.Excel.Range dataStartRange = newWorksheet.Cells[1, 2];

Microsoft.Office.Interop.Excel.Range dataEndRange = newWorksheet.Cells[rowlenght, columnlength1];

Microsoft.Office.Interop.Excel.Range dataRANGE = newWorksheet.Range[dataStartRange, dataEndRange];

dataRANGE.NumberFormat = numberFormat;

Microsoft.Office.Interop.Excel.Shape myChart = newWorksheet.Shapes.AddChart2(-1, XlChartType.xlLine, 250, 50, width, 165, true);

Excel.Chart chart = myChart.Chart;

// 设置图表标题

chart.HasTitle = true;

chart.ChartTitle.Text = onechartData.title;

chart.ChartTitle.Font.Name = zhongwenstr;

chart.ChartTitle.Font.Size = 8f;

chart.ChartTitle.Font.Bold = 1;

chart.ChartTitle.Font.Color = ColorTranslator.ToOle(Color.Black);

chart.ChartTitle.HorizontalAlignment = XlConstants.xlLeft;

chart.ChartTitle.Left = 0;

//chart.ChartArea.Left = 0;

chart.PlotArea.InsideLeft = 3;

chart.PlotArea.InsideWidth = 230;

Excel.SeriesCollection seriescollectionB2 = chart.SeriesCollection();

seriescollectionB2.Item(1).Delete();

string[] xarray = RangeHelper.GetOneColumnRange(XValues);

for (int i = 1; i <= indexcount; i++)

{

Excel.Series Orig = seriescollectionB2.NewSeries();

double[] yarrayy = new double[rowlenght];

for (int ii = 1; ii <= rowlenght; ii++)

{

Microsoft.Office.Interop.Excel.Range range = newWorksheet.Cells[ii, i + 1];

if (string.IsNullOrEmpty(range.Value2))

{

// yarrayy[ii - 1] = 0;

}

else

{

yarrayy[ii - 1] = Convert.ToDouble(range.Value2);

}

}

Orig.Name = list.ElementAt(i - 1).indexName;

Orig.XValues = xarray;

word插件开发支持哪些语言(word开发工具属性)

Orig.Values = yarrayy;

Orig.HasDataLabels = false;

if (i == 1)

{

Orig.AxisGroup = Microsoft.Office.Interop.Excel.XlAxisGroup.xlPrimary;

if (list.ElementAt(i-1).type == 1)

{

Orig.ChartType = XlChartType.xlLineStacked;

Orig.Format.Line.Weight = 1.2f;

Orig.Format.Line.ForeColor.RGB = StyleHelper.GetColorIntRGB(linecolor);

}

if (list.ElementAt(i-1).type == 2)

{

Orig.ChartType = XlChartType.xlColumnStacked;

Orig.Interior.Color = ColorTranslator.ToOle(Color.Gray);

}

Excel.Axis yAxis = (Excel.Axis)chart.Axes(Excel.XlAxisType.xlValue, Excel.XlAxisGroup.xlPrimary);

yAxis.HasDisplayUnitLabel = true;

yAxis.DisplayUnitCustom = 1;

yAxis.DisplayUnitLabel.Orientation = XlOrientation.xlHorizontal;

yAxis.DisplayUnitLabel.Left = 15;

yAxis.DisplayUnitLabel.Top = 10;

yAxis.DisplayUnitLabel.Font.Name = zhongwenstr;

yAxis.DisplayUnitLabel.Font.Size = 8f;

//yAxis.DisplayUnit=XlDisplayUnit.

yAxis.TickLabels.Font.Name = fontname;

yAxis.TickLabels.Font.Size = fontsize;

yAxis.TickLabels.Font.Color = XlRgbColor.rgbBlack;

yAxis.MajorTickMark = Excel.XlTickMark.xlTickMarkOutside;

yAxis.HasMinorGridlines = false;

yAxis.HasMajorGridlines = false;

yAxis.Format.Line.ForeColor.RGB = (int)XlRgbColor.rgbBlack;

yAxis.Format.Line.Weight = 1;

yAxis.Border.Color = ColorTranslator.ToOle(Color.Black);//y轴颜色

yAxis.DisplayUnitLabel.Text = list.ElementAt(i-1).unit;

 

}

if (i == 2)

{

if (list.ElementAt(i-1).type == 1)

{

Orig.ChartType = XlChartType.xlLineStacked;

Orig.Format.Line.Weight = 1.2f;

Orig.Format.Line.ForeColor.RGB = StyleHelper.GetColorIntRGB("0,174,239");

}

if (list.ElementAt(i-1).type == 2)

{

Orig.ChartType = XlChartType.xlColumnStacked;

Orig.Interior.Color = ColorTranslator.ToOle(Color.Gray);

}

 

Orig.AxisGroup = Microsoft.Office.Interop.Excel.XlAxisGroup.xlSecondary;

Excel.Axis ysecondAxis = (Excel.Axis)chart.Axes(Excel.XlAxisType.xlValue, Excel.XlAxisGroup.xlSecondary);

ysecondAxis.HasDisplayUnitLabel = true;

//ysecondAxis.DisplayUnit = XlDisplayUnit.xlHundreds;

ysecondAxis.DisplayUnitCustom = 1;

ysecondAxis.DisplayUnitLabel.Left = 210;

ysecondAxis.DisplayUnitLabel.Top = 10;

//ysecondAxis.DisplayUnitLabel.VerticalAlignment=

ysecondAxis.DisplayUnitLabel.Orientation = XlOrientation.xlHorizontal;

ysecondAxis.DisplayUnitLabel.Position = Excel.XlChartElementPosition.xlChartElementPositionCustom;

ysecondAxis.DisplayUnitLabel.Font.Name = zhongwenstr;

ysecondAxis.DisplayUnitLabel.Font.Size = 8f;

ysecondAxis.TickLabels.Font.Name = fontname;

ysecondAxis.TickLabels.Font.Size = fontsize;

ysecondAxis.TickLabels.Font.Color = ColorTranslator.ToOle(Color.Black);

ysecondAxis.DisplayUnitLabel.Text = list.ElementAt(i-1).unit;

ysecondAxis.Border.Color = ColorTranslator.ToOle(Color.Black);//y轴颜色

}

if (i == 3)

{

Orig.AxisGroup = Microsoft.Office.Interop.Excel.XlAxisGroup.xlSecondary;

if (list.ElementAt(i-1).type == 1)

{

Orig.ChartType = XlChartType.xlLine;

Orig.Format.Line.ForeColor.RGB = StyleHelper.GetColorIntRGB(linecolor);

Orig.Format.Line.Weight = 1.2f;

}

if (list.ElementAt(i-1).type == 2)

{

Orig.ChartType = XlChartType.xlColumnClustered;

Orig.Interior.Color = ColorTranslator.ToOle(Color.Gray);

}

Orig.HasDataLabels = false;

//StyleHelper.SetSeries(Orig, "55,155,30");

Orig.Format.Line.ForeColor.RGB = StyleHelper.GetColorIntRGB(linecolor);

Orig.Format.Line.Weight = 1;

Excel.Axis ysecondAxis = (Excel.Axis)chart.Axes(Excel.XlAxisType.xlValue, Excel.XlAxisGroup.xlSecondary);

ysecondAxis.HasDisplayUnitLabel = true;

ysecondAxis.DisplayUnitCustom = 1;

ysecondAxis.DisplayUnitLabel.Orientation = XlOrientation.xlHorizontal;

ysecondAxis.DisplayUnitLabel.Font.Name = zhongwenstr;

ysecondAxis.DisplayUnitLabel.Font.Size = 8f;

ysecondAxis.TickLabels.Font.Name = fontname;

ysecondAxis.TickLabels.Font.Size = fontsize;

ysecondAxis.TickLabels.Font.Color = XlRgbColor.rgbBlack;

ysecondAxis.DisplayUnitLabel.Text = list.ElementAt(i-1).unit;

ysecondAxis.Border.Color = ColorTranslator.ToOle(Color.Black);//y轴颜色

}

if (i == 4)

{

Orig.AxisGroup = Microsoft.Office.Interop.Excel.XlAxisGroup.xlSecondary;

if (list.ElementAt(i-1).type == 1)

{

Orig.ChartType = XlChartType.xlXYScatterLinesNoMarkers;

Orig.Format.Line.ForeColor.RGB = StyleHelper.GetColorIntRGB("0,174,239");

Orig.Format.Line.Weight = 1.2f;

}

if (list.ElementAt(i-1).type == 2)

{

Orig.Interior.Color = StyleHelper.GetColorIntRGB("0,55,120");

Orig.ChartType = XlChartType.xlColumnClustered;

}

//StyleHelper.SetSeries(Orig, "5,15,130");

Orig.Format.Line.ForeColor.RGB = StyleHelper.GetColorIntRGB(linecolor);

Orig.Format.Line.Weight = 1;

Excel.Axis ysecondAxis = (Excel.Axis)chart.Axes(Excel.XlAxisType.xlValue, Excel.XlAxisGroup.xlSecondary);

ysecondAxis.HasDisplayUnitLabel = true;

ysecondAxis.DisplayUnitLabel.Orientation = XlOrientation.xlHorizontal;

ysecondAxis.DisplayUnitCustom = 1;

ysecondAxis.DisplayUnitLabel.Font.Name = zhongwenstr;

ysecondAxis.DisplayUnitLabel.Font.Size = 8f;

ysecondAxis.TickLabels.Font.Name = fontname;

ysecondAxis.TickLabels.Font.Size = fontsize;

ysecondAxis.TickLabels.Font.Color = XlRgbColor.rgbBlack;

ysecondAxis.DisplayUnitLabel.Text = list.ElementAt(i-1).unit;

ysecondAxis.Border.Color = ColorTranslator.ToOle(Color.Black);//y轴颜色

}

}

// 设置y轴

//设置Y轴的显示

 

//yAxis.HasTitle = true;

Excel.Axis xAxis = (Excel.Axis)chart.Axes(Excel.XlAxisType.xlCategory, Excel.XlAxisGroup.xlPrimary);

 

xAxis.CategoryNames = xarray;

//xAxis.CategoryType = Excel.XlCategoryType.xlTimeScale;

xAxis.TickLabelPosition = Excel.XlTickLabelPosition.xlTickLabelPositionLow;

xAxis.TickLabels.Orientation = Excel.XlTickLabelOrientation.xlTickLabelOrientationDownward;

xAxis.TickLabels.Font.Name = fontname;

xAxis.TickLabels.NumberFormat = "yyyy-mm-dd";

xAxis.TickLabels.Font.Size = 8f;

xAxis.TickLabels.Font.Color = XlRgbColor.rgbBlack;

xAxis.MinorTickMark = Excel.XlTickMark.xlTickMarkOutside;

// xAxis.HasTitle = true;

//xAxis.AxisTitle.Orientation = Excel.XlOrientation.xlHorizontal;

 

//yAxis.HasDisplayUnitLabel = true;

xAxis.Format.Line.ForeColor.RGB = (int)XlRgbColor.rgbBlack;

xAxis.Format.Line.Weight = 1;

xAxis.Border.Color = ColorTranslator.ToOle(Color.Black);//y轴颜色

xAxis.TickLabels.MultiLevel = true;

chart.HasLegend = true;

chart.ChartTitle.Font.Name = zhongwenstr;

chart.Legend.Left = 80;

chart.Legend.Height = 15 * indexcount;

chart.Legend.IncludeInLayout = true;

chart.Legend.Top = 0;

chart.Legend.Width = 150;

// chart.Legend.Position = Excel.XlLegendPosition.xlLegendPositionTop;

chart.Legend.Font.Color = ColorTranslator.ToOle(Color.Black);

chart.Legend.Font.Name = zhongwenstr;

chart.Legend.Font.Size = 8f;

return myChart;

扫描二维码推送至手机访问。

版权声明:本文由西安泽虎代运营发布,如需转载请注明出处。

转载请注明出处https://www.0291.com.cn/post/42444.html

相关文章

抖音直播能得到多少份?抖音直播一个月能拿?

抖音直播能得到多少份?抖音直播一个月能拿?

 一、抖音怎么赚钱? 如果你是一个拥有27808657名粉丝的生活抖音专家,平均视频播放量为1697534,那么短视频报价为36.4万,长视频54.5万。如果现在在抖音上直播,最直接的赚钱方式就是获得音浪。粉丝奖励礼物后,可以用音浪直接提取人民币。 这就需要点击...

快手广告开户后,该如何投放快手原生广告?

快手广告开户后,该如何投放快手原生广告?

快手广告开户后,该如何投放快手原生广告? 快手广告开户后,若需要投放原生广告,只需以下3个步骤:①生产原生素材,②绑定真实的快手账号(达人账号、蓝v服务号、普通快手号),③在DSP平台创编时,在创意层级开启「原生广告投放」,下面将逐一、详细介绍: 一、原生素材生产标准 原生素材要求...

快手广告:04/02对外信息站周更新

快手广告:04/02对外信息站周更新

知识点  使用手册 快手信息流广告产品功能全解析—(持续更新)  快手磁力引擎广告-IAA行业信息站-2022版  快手磁力引擎广告审核标准&nb...

如何构建微信广告营销生意阵地?教你一招!

如何构建微信广告营销生意阵地?教你一招!

腾讯社交生态连接12亿消费者,微信不仅是个社交场,更是一个“交易场"。微信拥有10亿+日均交易笔数,5000万+月活跃商户;视频号拥有2亿日活跃用户;企业微信拥有250万家真实企业,476万系统接入;拥有搜一搜亿级的日搜索量。小程序高增幅领跑社交零售,社交电商总零售额2万亿,增速63%其中小程序占比...

运营数据分析师做啥的(数据分析师需要的技能)

运营数据分析师做啥的(数据分析师需要的技能)

最近一段时间,我看后台有很多小伙伴私信我,让我讲解一下数据分析师目前的行业形势,那么今天它来了。 岗位介绍 数据分析师的工作内容主要有以下四点要求; 1、负责公司各信息化系统的数据收集、清洗、分析,制作可视化报表;保障数据的准确性、一致性、稳定性、及时性; 2、通过对公司各项...

抖音在平板上为什么不能横屏直播(平板电脑抖音横屏设置方法)

抖音在平板上为什么不能横屏直播(平板电脑抖音横屏设置方法)

据Tech星球报道,知情人士透露,抖音团队近期在内测应用于PC端、平板端的抖音新版本。 据悉,抖音PC端将是横屏模式,产品主要分为“首页”、“同城”、“搜索”、“设置”四个功能部分,而“首页”功能区,依然保留“关注”“推荐”两大选项。在视频播放界面,用户可以点击界面中央的功能按钮,实现相应的...

现在,非常期待与您的又一次邂逅

我们努力让每一部企业宣传片和抖音短视频成为商业大片