搜索
查看
编辑修改
首页
UNITY
NODEJS
PYTHON
AI
GIT
PHP
GO
CEF3
JAVA
HTML
CSS
搜索
你好赵伟
这个屌丝很懒,什么也没留下!
关注作者
热门标签
jquery
HTML
CSS
PHP
ASP
PYTHON
GO
AI
C
C++
C#
PHOTOSHOP
UNITY
iOS
android
vue
xml
爬虫
SEO
LINUX
WINDOWS
JAVA
MFC
CEF3
CAD
NODEJS
GIT
Pyppeteer
article
热门文章
1
【学习笔记】kaggle案例之泰坦尼克号(基于R)_r语言泰坦尼克号随机森林案例数据分析报告
2
MongoDB精简入门(体系结构、Docker安装MangoDB、常用命令)_docker安装的mongodb如何查看配置
3
Claude3超大杯发布,将取代ChatGPT4?
4
[LaTex] 多文件编译 | 分段编译_latex如何将多个tex文件编译到一起
5
vue项目打包及查看_vue怎么查看项目中设置的打包命令
6
Python 与 Perl的优缺点_perl python
7
计算机毕业设计-ssm智能小区管理系统(源码+数据库+文档)社区维修管理系统-小区缴费管理系统javaweb项目_小区缴费数据库
8
java类中找不到kotlin的类_找不到kotlin.metadata的类文件
9
NRF52832主机主动断开连接sd_ble_gap_disconnect()
10
SpringBoot自定义注解 + AOP 防止重复提交(建议收藏)_springboot防止表单重复提交
当前位置:
article
> 正文
C#让Excel中数据自动生成图表_c#excel自动绘制流程图
作者:你好赵伟 | 2024-03-16 14:37:14
赞
踩
c#excel自动绘制流程图
private void CreateChart(Excel._Workbook m_Book,Excel._Worksheet m_Sheet,int num)
{
Excel.Range oResizeRange;
Excel.Series oSeries;
m_Book.Charts.Add(Missing.Value, Missing.Value, 1, Missing.Value);
m_Book.ActiveChart.ChartType = Excel.XlChartType.xlLine;//设置图形
//设置数据取值范围
m_Book.ActiveChart.SetSourceData(m_Sheet.get_Range("A2", "C" + num.ToString()), Excel.XlRowCol.xlColumns);
//m_Book.ActiveChart.Location(Excel.XlChartLocation.xlLocationAutomatic, title);
//以下是给图表放在指定位置
m_Book.ActiveChart.Location(Excel.XlChartLocation.xlLocationAsObject, m_Sheet.Name);
oResizeRange = (Excel.Range)m_Sheet.Rows.get_Item(10, Missing.Value);
m_Sheet.Shapes.Item("Chart 1").Top = (float)(double)oResizeRange.Top; //调图表的位置上边距
oResizeRange = (Excel.Range)m_Sheet.Columns.get_Item(6, Missing.Value); //调图表的位置左边距
// m_Sheet.Shapes.Item("Chart 1").Left = (float)(double)oResizeRange.Left;
m_Sheet.Shapes.Item("Chart 1").Width = 400; //调图表的宽度
m_Sheet.Shapes.Item("Chart 1").Height = 250; //调图表的高度
m_Book.ActiveChart.PlotArea.Interior.ColorIndex = 19; //设置绘图区的背景色
m_Book.ActiveChart.PlotArea.Border.LineStyle = Excel.XlLineStyle.xlLineStyleNone;//设置绘图区边框线条
m_Book.ActiveChart.PlotArea.Width = 400; //设置绘图区宽度
//m_Book.ActiveChart.ChartArea.Interior.ColorIndex = 10; //设置整个图表的背影颜色
//m_Book.ActiveChart.ChartArea.Border.ColorIndex = 8;// 设置整个图表的边框颜色
m_Book.ActiveChart.ChartArea.Border.LineStyle = Excel.XlLineStyle.xlLineStyleNone;//设置边框线条
m_Book.ActiveChart.HasDataTable = false;
//设置Legend图例的位置和格式
m_Book.ActiveChart.Legend.Top = 20.00; //具体设置图例的上边距
m_Book.ActiveChart.Legend.Left = 60.00;//具体设置图例的左边距
m_Book.ActiveChart.Legend.Interior.ColorIndex = Excel.XlColorIndex.xlColorIndexNone;
m_Book.ActiveChart.Legend.Width = 150;
m_Book.ActiveChart.Legend.Font.Size = 9.5;
//m_Book.ActiveChart.Legend.Font.Bold = true;
m_Book.ActiveChart.Legend.Font.Name = "宋体";
//m_Book.ActiveChart.Legend.Position = Excel.XlLegendPosition.xlLegendPositionTop;//设置图例的位置
m_Book.ActiveChart.Legend.Border.LineStyle = Excel.XlLineStyle.xlLineStyleNone;//设置图例边框线条
//设置X轴的显示
Excel.Axis xAxis = (Excel.Axis)m_Book.ActiveChart.Axes(Excel.XlAxisType.xlValue, Excel.XlAxisGroup.xlPrimary);
xAxis.MajorGridlines.Border.LineStyle = Excel.XlLineStyle.xlDot;
xAxis.MajorGridlines.Border.ColorIndex = 1;//gridLine横向线条的颜色
xAxis.HasTitle = false;
xAxis.MinimumScale = 1500;
xAxis.MaximumScale = 6000;
xAxis.TickLabels.Font.Name = "宋体";
xAxis.TickLabels.Font.Size = 9;
//设置Y轴的显示
Excel.Axis yAxis = (Excel.Axis)m_Book.ActiveChart.Axes(Excel.XlAxisType.xlCategory, Excel.XlAxisGroup.xlPrimary);
yAxis.TickLabelSpacing = 30;
yAxis.TickLabels.NumberFormat = "M月D日";
yAxis.TickLabels.Orientation = Excel.XlTickLabelOrientation.xlTickLabelOrientationHorizontal;//Y轴显示的方向,是水平还是垂直等
yAxis.TickLabels.Font.Size = 8;
yAxis.TickLabels.Font.Name = "宋体";
//m_Book.ActiveChart.Floor.Interior.ColorIndex = 8;
/***以下是设置标题*****
m_Book.ActiveChart.HasTitle=true;
m_Book.ActiveChart.ChartTitle.Text = "净值指数";
m_Book.ActiveChart.ChartTitle.Shadow = true;
m_Book.ActiveChart.ChartTitle.Border.LineStyle = Excel.XlLineStyle.xlContinuous;
*/
oSeries = (Excel.Series)m_Book.ActiveChart.SeriesCollection(1);
oSeries.Border.ColorIndex = 45;
oSeries.Border.Weight = Excel.XlBorderWeight.xlThick;
oSeries = (Excel.Series)m_Book.ActiveChart.SeriesCollection(2);
oSeries.Border.ColorIndex = 9;
oSeries.Border.Weight = Excel.XlBorderWeight.xlThick;
}
本文内容由网友自发贡献,转载请注明出处:
https://www.wpsshop.cn/w/你好赵伟/article/detail/250103
推荐阅读
article
如何在
Java
中以编程
的
方式将
CSV
转为
Excel
XLSX
文件
...
Microsoft
Excel
的
XLSX
格式以及基于文本
的
CSV
(逗号分隔值)格式,是数据交换中常见
的
文件
格式。应用程序...
赞
踩
article
如何在
java
中
使用
Excel
动态函数生成
依赖
列表
...
在
Excel
中
,
依赖
列表
或级联下拉
列表
表示两个或多个
列表
,其
中
一个
列表
的项根据另一个
列表
而变化。
依赖
列表
通常用于Exc...
赞
踩
article
python
读取
文件
_Python 读取各类
文件
格式的文本信息 |
doc
,
excel
,
html
,m...
(点击上方快速关注并设置为星标,一起学Python)引言众所周知,
python
最强大的地方在于,
python
社区汇总拥有...
赞
踩
article
python
读取
html
文件
中的表格
数据
_
Python
读取
各类
文件
格式的文本信息 | doc,ex...
原标题:
Python
读取
各类
文件
格式的文本信息 | doc,
excel
,
html
,mht众所周知,
python
最强大的...
赞
踩
article
基于
python
将
表格
转化成
html
_
python
&
excel
报表转
html
...
安装包 pip install xlsx2
html
xlsx
表格
样式如将
excel
表格
的内容
转化成
html
,并在页面...
赞
踩
article
Python
EXCEL
转图片转PDF,
HTML
转图片转PDF,
EXCEL
转
HTML
, EX...
# -*- coding:utf-8 -*-__author__ = 'Mooney'import codecsimpo...
赞
踩
article
Python
excel
转成
html
页面
excel
在线预览
_
python
将
excel
转
页面
...
Python
excel
转成
html
页面
excel
在线预览因为这两天公司的项目要用到在浏览
excel
所以就在做这个...
赞
踩
相关标签
java
excel
开发语言
后端
python读取文件
python读取html文件中的表格数据
excel 转图片
excel 转PDF
python
html