插入数据到excle的指定位置

C#向Word和Excle中写入数据 //设置文件过滤器 if (FileFormat == "Microsoft Word") { saveFileDialog.Filter = "Word 文档(*.docx)|*.docx"; } else { 阅读详情

将信息插入到Excel文件的指定位置

步骤

  • 创建File
  • 和获取文件、建立副本
  • 获取表
  • 定位到指定位置
  • 遍历所有位置
  public void insert(String name){
    File file = new File("data/aa"+name+".xls");
    try {
            //obtain the original excel
            Workbook wb = Workbook.getWorkbook(_file);
            WritableWorkbook book = Workbook.createWorkbook(_file,wb);

            //obtain the sheet
            WritableSheet sheet = book.getSheet(0);

            //Split inserted data
            String in_bracket = value_list.substring(1, value_list.length()-1);
            String []valuelist = in_bracket.split(",");

            WritableCell cell = null;
            int Rows = sheet.getRows();
            for(int i = 0; i < valuelist.length;i++){               
                cell = new Label(i, Rows, valuelist[i]);
                try {
                    sheet.addCell(cell);
                } catch (RowsExceededException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                } catch (WriteException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
            book.write();
            try {
                book.close();
            } catch (WriteException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }               
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
  }

声明:
本文是作者实践时的心得记录,在特定项目下生效,不具有普适性

【Excel 教程系列第 9 篇】如何添加跳转到指定单元格位置的按钮 我们在编辑一个工作表中的内容时,如果想查看另一个工作表中的数据,就需要先点击下方的对应的工作表标签,再滑动鼠标滚轮或者拖动滑块去定位表格位置后查看。 多次重复这种操作,会花费一定的时间,降低工作效率。 这种情况下,我们可以在 Excel 中添加一个定位按钮,利用 Excel 的链接功能快速跳转到想要查看的位置 阅读详情

相关推荐

从3D相机数据到三维模型:Halcon实战深度图、亮度图与点云转换全流程

本文详细解析了如何利用Halcon将3D相机采集的深度图、亮度图转换为三维点云模型的完整流程。通过实战案例分享,涵盖数据格式处理、点云生成方法(SDK接口与纯Halcon实现)、三维模型可视化优化等关键技术,帮助工程师解决工业检测中的实际难题,提升三维重建精度与效率。

weixin_42525005的博客 396

向Excel文件指定Sheet中写入数据,同时不影响其他Sheet

向Excel文件指定Sheet中写入数据,同时不影响其他Sheet的值。通过降低pandas版本处理IndexError: At least one sheet must be visible 或者 pandas._config.config.OptionError: "No such keys(s): 'io.excel.zip.reader'"报错的一种情形。

weixin_58204963的博客 2353

【全部更新】2025金地杯E题山西省大学生数学建模思路代码文章教学:高速铁路牵引供电系统能耗优化

问题四将列车的运行速度与发车时间同时作为优化变量,建立联合优化模型,目标是在考虑电价机制和调度均衡性的前提下,使牵引供电系统一天内的总电费支出最小。问题三在考虑分时电价机制的基础上,基于遗传算法优化列车速度组合,使牵引供电系统一天内的总电费支出最小。然而,在实际运营中,不同时段的电价差异显著,合理安排列车的运行时间与运行速度,可有效降低系统的总电费支出。本研究聚焦于高速铁路牵引供电系统的能耗与电费优化问题,针对列车运行速度、发车时间与分时电价的综合影响,提出一系列数学模型,以实现系统能耗与电费的最小化。

xb459149247的博客 5289

Python-openpyxl-在Excel表格指定区域写入指定数据

重点2:定义的函数可以将Values按指定区域传入,在函数参数中指定起始行号和列号,即可通过函数遍历所有取值,得到该区域。重点1:指定值要写成列表list形式,一行一个list,区域为一个大list;

2301_77519049的博客 3572

手把手教你用CubeMX给GD32F103点灯、调串口(附完整工程)

本文详细介绍了如何使用CubeMX为GD32F103开发板配置GPIO点灯和串口通信,包含完整的工程创建、代码构建和测试流程。特别强调了GD32与STM32的差异点及常见避坑技巧,帮助开发者快速上手GD32开发。

weixin_42566424的博客 313

(小白记录)使用c语言在Excel里面追加数据

局部代码为: FILE *fp1; fp1=fopen("C:/Users/yf/Documents/Visual Studio 2010/Projects/ReadTime/ReadTime/ReadTime.xls","a+"); // fp指针指向文件头部 //fopen打开文件 fseek(fp1, 0, SEEK_END); //fseek指针定位到最后一个数据 if(fp1 == NULL) { printf("打开失败\n"); system("PAUSE");

顾染尘 824

SAP 财务接口开发:完全清账 vs 标准过账的 CO-PA(获利能力字段) 赋值全解析(含设计哲学)

用于完全清账场景:用于标准凭证过账/部分清账两者对 CO-PA 数据的传递方式截然不同。本文不仅提供完整的代码实现,更深入解析为什么 SAP 要这样设计——了解设计哲学,才能灵活应对各类需求。完全清账→ 调用,必须在T_FTPOST中传递,其他特征用BSEG-RKE_前缀。标准过账/部分清账→ 调用,在CRITERIA表中传递特征,字段名直接用WERKSARTNR等。SAP 的设计智慧面向不同场景,采用不同机制,各司其职。通过接口抽象,将复杂的 CO-PA 配置逻辑封装在内部,对外提供简洁的调用方式。

Pegasus666的博客 328

使用xlsx库进行解析excel 并将解析的excel数据插入到数据库对应的字段中

一、首先新建一个html页面,引入xlsx.core.min.js和jquery-3.4.0.js包。 1、添加点击上传excel文件如下: <input type='file' id="upLoadExcel"/> 2、前端上传文件及封装自己需要的数据类型并传入后台的代码如下: //上传解析excel表格并插入到数据库 $("#upLoadExcel").change(function (e) { var files = e.target.files;

qq_45668217的博客 1027

MATLAB实现灰雁优化算法(GGO):从原理到实战的详细级教程

灰雁优化算法(GGO)是一种新型群体智能算法,模拟灰雁迁徙和觅食行为。算法通过领导更替机制、V形编队飞行和群体觅食策略,平衡全局探索与局部开发能力,具有收敛精度高、避免局部最优等特点。在MATLAB环境中,算法实现包括初始化种群、迭代更新领导雁、执行编队飞行和觅食行为等核心模块。用户可根据问题维度设置参数,通过收敛曲线和可视化分析评估性能。关键参数如领导更替频率、V形编队强度和觅食强度需根据问题复杂度调整,以获得最佳优化效果。该算法适用于各类优化问题,具有较好的鲁棒性和稳定性。

fx666_的博客 1212

CVAEGAN实现锂离子电池EIS数据增强:基于健康状态的阻抗谱生成

本文提出了一种基于CVAEGAN的锂离子电池EIS数据增强方法。该方法结合了变分自编码器和生成对抗网络的优点,能够根据指定的健康状态(SoH)生成高质量的EIS阻抗谱数据。文章详细介绍了数据预处理流程、模型架构设计(包括编码器、解码器和判别器),并提供了完整的PyTorch实现代码。通过条件生成的方式,该方法可以有效解决电池健康评估中标注数据不足的问题,为基于数据驱动的电池诊断提供更丰富的训练样本。实验结果表明,生成的EIS数据具有良好的真实性和多样性,可用于增强电池健康状态评估模型的性能。

huanghm88的专栏 497

java向excel的指定的sheet中指定的单元格中写入数据

这里写目录标题准备工具类代码 准备 <dependency> <groupId>org.apache.poi</groupId> <artifactId>poi</artifactId> <version>4.0.1</version> </dependency> <dependency> <groupId>org.apache.poi</groupId

张小三的博客 7907

【软考之软件设计师】学习笔记

interface 接口implements 实现接口(与接口配套使用)接口里要是有方法定义,子类就会实现。

云轩阁 2533

EXCLE批量插入图片VBA代码

输入入下vba代码: Sub 批量插入图片() Dim address As String Dim cellcolumn, piccolumn As Integer On Error Resume Next '容错处理 address = “E:\商品图片” '图片文件夹所在的位置,根据图片位置修改 cellcolumn = 1 '设置款号所在列,根据自己实际情况修改 piccolumn =...

qdliuminghao的博客 4416

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

SIMATIC S7-1200, S7-1500 PID 控制[手册]

SIMATIC S7-1200, S7-1500 PID 控制[手册]

EXCLE图形插入实例

根据所给名称找到相应图片,并进行导入。 代码如下: Sub Import_picture() For Each shap In Sheet1.Shapes '在sheet1中的图片对象进行循环 If shap.Type &lt;&gt; 8 Then shap.Delete '在插入图片之前删除以前插入的图片,但不删除命令按钮 Next shap For Each Rng...

weixin_34358092的博客 158

IMSL CNL 7.0.0 (x86-64)Crack

IMSL CNL 7.0.0 (x86-64)Crack intel的算法库破解文件,这是C++版本的破解文件

Excle数据透视表

王佩丰Excle课程第六课时笔记 数据透视表 创建数据透视表 插入——数据透视表,然后拖选行、列和值字段,点击值字段下拉箭头——值字段设置——可以更改计算类型。 在创建好的数据透视表中,双击某个数字,会出现一个新表,新表中展示了,统计这个数字的具体信息,就是由哪些值计算而来的。 行字段有两个字段(两列)的数据透视表,如: 插入——数据透视表,出现 在上图区域上右击——数据透视表选项——显示...

yangyuxianerer的博客 608

廖雪峰Python教程[完整版]

廖雪峰的python教程整理的,已经排好版了,而且还是完整的,适合小白

Word 邮件合并功能(Excel表中指定列数据插入到Word模板指定位置,批量生成Word)

论文高级排版的操作顺序 页面大小、页面边距设置 设置不同级别标题样式,然后在多级列表中对样式序列修改关联 在图片、表格上添加“题注”,然后对题注样式“题注”进行修改 使用”奇数分页“分隔符对每章进行分节 添加页眉、页脚和页码 生成目录 高级排版教程(侵权请私信留言,必删) 邮件合并功能(Excel表中指定列数据插入到Word模板指定位置,批量生成Word) List item List it...

Try_again_once的博客 8900

怎么把ppt弄成链接的形式_ppt链接excle表格:如何在ppt中超级链接到指定的excel工作表...

PPT里面怎么链接excel表?1、第一步开PPT,翻页至想要插入的页面。选择卡,在插入的子选项卡中选择对象选项。2、在弹出的页面中,选择由文件创建 ,然后点击浏览3、选中需要插入的EXCEL表格,点击确定。4、在弹出的一下界面中,勾选显示为图标 ,千万不要勾选链接,选择完毕后,点击确定即可。5、这样我们已经成功的完成了excel的添加,接下来书生将教你如何在播放时候单击excel图标即可打开该E...

weixin_39815310的博客 6870

Java Poi 操作Excle

iLife's 博客http://blog.youkuaiyun.com/fei1502816 1.创建一个新的Excle工作薄 // 创建新的Excel 工作簿 HSSFWorkbook workbook = new HSSFWorkbook(); // 在Excel工作簿中建一工作表,其名为缺省值, 也可以指定Sheet名称 HSSFSheet sheet = w

渣 4305

c++ string删除指定位置字符_单元格中指定位置的字符(Excel表格中的替换函数substitute)...

一、函数英语单词substitute英 [ˈsʌbstɪtjuːt] 美 [ˈsʌbstɪtuːt]n. 代用品;代替者vi. 替代vt. 代替excel函数中,substitute函数我们取:把……替换成……的意思来进行理解。二、函数含义和参数substitute函数的分类属于:文本函数打开excel表格,点击编辑栏前的插入函数图标fx,弹出插入函数窗口,在选择类别中选择分类:文本函数,可看到该...

weixin_39760434的博客 461

使用jxl生成Excle文件的代码总结

package JExcelTest.standard; import java.io.*; import java.text.SimpleDateFormat; import java.util.Date; import jxl.*; import jxl.format.UnderlineStyle; import jxl.write....

aaa9736的博客 169

若依框架导入Excle

1.在html 工具栏 toolbar div 层添加代码 <a class="btn btn-info" onclick="$.table.importExcel()"> <i class="fa fa-upload"></i> 导入 </a> 效果如下: 2. 添加导入弹框提示区域代码 <script id="importTpl" type="text/template"> <form enctype="multi

qq_45767167的博客 4172

【Excle】二维表转化为一维表

现在我们想做如下操作:想把表1的数据转化为表2的数据,那么我们只需要如下这段代码即可解决需求Sub 转置() Dim i%, arr arr = Application.InputBox("选择区域", Type:=8) t1 = UBound(arr) t2 = UBound(arr, 2) ReDim brr(1 To t1 * t2, 1 To 3) For i = 2 To t1...

ajsyipsc40270的博客 296

python操作excle表格

基础练习 话不多说,先做一下基础练习。来,左边跟我一起画个龙,右边画一道彩虹。 # import paramiko # import time import openpyxl from openpyxl import Workbook # study from "https://openpyxl.readthedocs.io/en/stable/" # 操作Excle流程 wb = Workbo...

weixin_43431593的博客 1万+

【Excle】动态更新数据下拉菜单

现在我们制作了一个简单的下拉菜单,如下:但是随着公司的逐渐扩大,部门也变得多了,目前我是把数据范围写死的,所有每次添加一个部门,就得修改数据范围,那么现在我们不想修改这个范围了,想让他每次添加部门后,下拉菜单自己同步方法一:使用函数我们使用offset函数来动态的引用,使用快捷键【ctrl+F3】打开【名称管理器】定义名称如下:引用位置内容:=OFFSET(Sheet3!$A$2:$A$...

ajsyipsc40270的博客 322

Excle 基本操作

1、行高及列宽调整 三种方法调整列宽行高: 1.直接鼠标拖拽线条 2.框选数据后双击线条产生最合适数值 3.框选数据右键设置具体数值。 2、行列编辑 插入行或者列,可以下选择要插入的位置,然后右键插入。 删除行列,选择要删除的行或者列,然后右键删除,会有多种数据移动模式选择。 要隐藏某一行或列,可以选择列或者行右键选择隐藏。 3、行列移动复制 移动行/列,先选择要移动行/列,然后右键剪切,选择要移动的到的位置,右键粘贴。 复制快捷键:Ctrl+C;粘贴快捷键:Ctrl+V;剪切快捷键: Ctrl+

MW 259
上一篇: java读取excle指定位置的数据
下一篇: java读取xml
Ziv_thinking
博客等级 码龄9年 0粉丝 9原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值