当前位置: 首页 > news >正文

使用com组件编辑word

 一个普通的窗体应用,6个button

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using MsWord = Microsoft.Office.Interop.Word;
using Microsoft.Office.Interop.Word;
using System.IO;
using Spire.Doc;
using Spire.Doc.Documents;
using Spire.Doc.Fields;namespace wordcomtest
{public partial class Form1 : Form{public Form1(){InitializeComponent();}private void Form1_Load(object sender, EventArgs e){}public static class common{public static MsWord.Application oWordApplic;//a reference to Wordapplicationpublic static MsWord.Document oDoc;//a reference to thedocumentpublic static string doc_file_name = Directory.GetCurrentDirectory() + @"\content.doc";}private void button1_Click(object sender, EventArgs e){try{if (File.Exists(common.doc_file_name)){File.Delete(common.doc_file_name);}common.oWordApplic = new MsWord.Application();object missing = System.Reflection.Missing.Value;}catch (Exception e2){MessageBox.Show(e2.Message);}try{ }catch (Exception e2){MessageBox.Show(e2.Message);}}private void button2_Click(object sender, EventArgs e){try{MsWord.Range curRange;object curTxt;int curSectionNum = 1;common.oDoc = common.oWordApplic.Documents.Add();common.oDoc.Activate();//Console.WriteLine(" 正在生成文档小节");object section_nextPage = MsWord.WdBreakType.wdSectionBreakNextPage;object page_break = MsWord.WdBreakType.wdPageBreak;//添加三个分节符,共四个小节for (int si = 0; si < 2; si++){common.oDoc.Paragraphs[1].Range.InsertParagraphAfter();common.oDoc.Paragraphs[1].Range.InsertBreak(ref section_nextPage);}}catch (Exception e2){MessageBox.Show(e2.Message);}}private void button3_Click(object sender, EventArgs e){try{int curSectionNum = 1;var curRange = common.oDoc.Sections[curSectionNum].Range.Paragraphs[1].Range;curRange.Select();string one_str, key_word;//摘要的文本来自 abstract.txt 文本文件StreamReader file_abstract = new StreamReader("abstract.txt");common.oWordApplic.Options.Overtype = false;//overtype 改写模式MsWord.Selection currentSelection = common.oWordApplic.Selection;if (currentSelection.Type == MsWord.WdSelectionType.wdSelectionNormal){one_str = file_abstract.ReadLine();//读入题目currentSelection.TypeText(one_str);currentSelection.TypeParagraph(); //添加段落标记currentSelection.TypeText(" 摘要");//写入" 摘要" 二字currentSelection.TypeParagraph(); //添加段落标记key_word = file_abstract.ReadLine();//读入题目one_str = file_abstract.ReadLine();//读入段落文本while (one_str != null){currentSelection.TypeText(one_str);currentSelection.TypeParagraph(); //添加段落标记one_str = file_abstract.ReadLine();}currentSelection.TypeText(" 关键字:");currentSelection.TypeText(key_word);currentSelection.TypeParagraph(); //添加段落标记}file_abstract.Close();}catch (Exception e2){MessageBox.Show(e2.Message);}}private void button4_Click(object sender, EventArgs e){try{int curSectionNum = 3;common.oDoc.Sections[curSectionNum].Range.Paragraphs[1].Range.Select();Range curRange = common.oDoc.Sections[curSectionNum].Range.Paragraphs[1].Range;Console.WriteLine(" 正在设置标题样式");object wdFontSizeIndex;wdFontSizeIndex = 14;//此序号在 word 中的编号是格式 > 显示格式 > 样式和格式 > 显示//14 即是标题一一级标题:三号黑体。common.oWordApplic.ActiveDocument.Styles.get_Item(ref wdFontSizeIndex).ParagraphFormat.Alignment =MsWord.WdParagraphAlignment.wdAlignParagraphCenter;common.oWordApplic.ActiveDocument.Styles.get_Item(ref wdFontSizeIndex).Font.Name = " 黑体";common.oWordApplic.ActiveDocument.Styles.get_Item(ref wdFontSizeIndex).Font.Size = 16;//三号wdFontSizeIndex = 15;//15 即是标题二二级标题:小三号黑体。common.oWordApplic.ActiveDocument.Styles.get_Item(ref wdFontSizeIndex).Font.Name = " 黑体";common.oWordApplic.ActiveDocument.Styles.get_Item(ref wdFontSizeIndex).Font.Size = 15;//小三//用指定的标题来设定文本格式object Style1 = MsWord.WdBuiltinStyle.wdStyleHeading1;//一级标题:三号黑体。object Style2 = MsWord.WdBuiltinStyle.wdStyleHeading2;//二级标题:小三号黑体。common.oDoc.Sections[curSectionNum].Range.Select();var currentSelection = common.oWordApplic.Selection;//读入第一章文本信息StreamReader file_content = new StreamReader("content.txt");var one_str = file_content.ReadLine();//一级标题currentSelection.TypeText(one_str);currentSelection.TypeParagraph(); //添加段落标记one_str = file_content.ReadLine();//二级标题currentSelection.TypeText(one_str);currentSelection.TypeParagraph(); //添加段落标记one_str = file_content.ReadLine();//正文while (one_str != null){currentSelection.TypeText(one_str);currentSelection.TypeParagraph(); //添加段落标记one_str = file_content.ReadLine();//正文}file_content.Close();//段落的对齐方式curRange = common.oDoc.Sections[curSectionNum].Range.Paragraphs[1].Range;curRange.set_Style(ref Style1);common.oDoc.Sections[curSectionNum].Range.Paragraphs[1].Alignment =MsWord.WdParagraphAlignment.wdAlignParagraphCenter;curRange = common.oDoc.Sections[curSectionNum].Range.Paragraphs[2].Range;curRange.set_Style(ref Style2);//第一章正文文本格式for (int i = 3; i < common.oDoc.Sections[curSectionNum].Range.Paragraphs.Count; i++){curRange = common.oDoc.Sections[curSectionNum].Range.Paragraphs[i].Range;curRange.Select();curRange.Font.Name = " 宋体";curRange.Font.Size = 12;common.oDoc.Sections[curSectionNum].Range.Paragraphs[i].LineSpacingRule =MsWord.WdLineSpacing.wdLineSpaceMultiple;//多倍行距,1.25 倍,这里的浮点值是以 point 为单位的,不是行距的倍数common.oDoc.Sections[curSectionNum].Range.Paragraphs[i].LineSpacing = 15f;common.oDoc.Sections[curSectionNum].Range.Paragraphs[i].IndentFirstLineCharWidth(2);}}catch (Exception e2){MessageBox.Show(e2.Message);}}private void button5_Click(object sender, EventArgs e){try{object missing = System.Reflection.Missing.Value;//设置页脚 section 1 摘要int curSectionNum = 1;common.oDoc.Sections[curSectionNum].Range.Select();//进入页脚视图common.oWordApplic.ActiveWindow.ActivePane.View.SeekView =MsWord.WdSeekView.wdSeekCurrentPageFooter;common.oDoc.Sections[curSectionNum].Headers[MsWord.WdHeaderFooterIndex.wdHeaderFooterPrimary].Range.Borders[MsWord.WdBorderType.wdBorderBottom].LineStyle =MsWord.WdLineStyle.wdLineStyleNone;common.oWordApplic.Selection.HeaderFooter.PageNumbers.RestartNumberingAtSection = true;common.oWordApplic.Selection.HeaderFooter.PageNumbers.NumberStyle= MsWord.WdPageNumberStyle.wdPageNumberStyleUppercaseRoman;common.oWordApplic.Selection.HeaderFooter.PageNumbers.StartingNumber = 1;//切换到文档common.oWordApplic.ActiveWindow.ActivePane.View.SeekView =MsWord.WdSeekView.wdSeekMainDocument;//Console.WriteLine(" 正在设置第二节目录页眉内容");//设置页脚 section 2 目录curSectionNum = 2;common.oDoc.Sections[curSectionNum].Range.Select();//进入页脚视图common.oWordApplic.ActiveWindow.ActivePane.View.SeekView =MsWord.WdSeekView.wdSeekCurrentPageFooter;common.oDoc.Sections[curSectionNum].Headers[MsWord.WdHeaderFooterIndex.wdHeaderFooterPrimary].Range.Borders[MsWord.WdBorderType.wdBorderBottom].LineStyle =MsWord.WdLineStyle.wdLineStyleNone;common.oWordApplic.Selection.HeaderFooter.PageNumbers.RestartNumberingAtSection = false;common.oWordApplic.Selection.HeaderFooter.PageNumbers.NumberStyle= MsWord.WdPageNumberStyle.wdPageNumberStyleUppercaseRoman;//oWordApplic.Selection.HeaderFooter.PageNumbers.StartingNumber = 1;//切换到文档common.oWordApplic.ActiveWindow.ActivePane.View.SeekView =MsWord.WdSeekView.wdSeekMainDocument;//第一章页眉页码设置curSectionNum = 3;common.oDoc.Sections[curSectionNum].Range.Select();//切换入页脚视图common.oWordApplic.ActiveWindow.ActivePane.View.SeekView =MsWord.WdSeekView.wdSeekCurrentPageFooter;var currentSelection = common.oWordApplic.Selection;var curRange = currentSelection.Range;//本节页码不续上节common.oWordApplic.Selection.HeaderFooter.PageNumbers.RestartNumberingAtSection = true;//页码格式为阿拉伯common.oWordApplic.Selection.HeaderFooter.PageNumbers.NumberStyle= MsWord.WdPageNumberStyle.wdPageNumberStyleArabic;//起如页码为 1common.oWordApplic.Selection.HeaderFooter.PageNumbers.StartingNumber = 1;//添加页码域object fieldpage = MsWord.WdFieldType.wdFieldPage;common.oWordApplic.Selection.Fields.Add(common.oWordApplic.Selection.Range,ref fieldpage, ref missing, ref missing);//居中对齐common.oWordApplic.Selection.ParagraphFormat.Alignment =MsWord.WdParagraphAlignment.wdAlignParagraphCenter;//本小节不链接到上一节common.oDoc.Sections[curSectionNum].Headers[Microsoft.Office.Interop.Word.WdHeaderFooterIndex.wdHeaderFooterPrimary].LinkToPrevious = false;//切换入正文视图common.oWordApplic.ActiveWindow.ActivePane.View.SeekView =MsWord.WdSeekView.wdSeekMainDocument;}catch (Exception e2){MessageBox.Show(e2.Message);}}private void button6_Click(object sender, EventArgs e){try{//common.oDoc.Fields[1].Update();//保存文档//Console.WriteLine(" 正在保存 Word 文档");//string doc_file_name = Directory.GetCurrentDirectory() + @"\content.doc";object fileName;fileName = common.doc_file_name;common.oDoc.SaveAs(ref fileName);common.oDoc.Close();//释放 COM 资源System.Runtime.InteropServices.Marshal.ReleaseComObject(common.oDoc);common.oDoc = null;common.oWordApplic.Quit();System.Runtime.InteropServices.Marshal.ReleaseComObject(common.oWordApplic);common.oWordApplic = null;Spire.Doc.Document document = new Spire.Doc.Document(@"content.doc");Spire.Doc.Section section = document.AddSection();Spire.Doc.HeaderFooter footer = document.Sections[0].HeadersFooters.Footer;//Add text and image to the footerSpire.Doc.Documents.Paragraph paragraph = footer.AddParagraph();DocPicture footerImage = paragraph.AppendPicture(Image.FromFile("whu.png"));TextRange TR = paragraph.AppendText("Supported and Hosted by the non-profit Wikimedia Foundation.");//Format the text and imageparagraph.Format.HorizontalAlignment = Spire.Doc.Documents.HorizontalAlignment.Left;TR.CharacterFormat.FontName = "Calibri";TR.CharacterFormat.Bold = true;//添加一个Shape,并设置其大小和样式Spire.Doc.Documents.Paragraph paragraph1 = section.AddParagraph();ShapeObject shape = paragraph1.AppendShape(240, 60, ShapeType.TextWave);//设置shape的位置shape.VerticalPosition = 80;shape.HorizontalPosition = 100;//写入艺术字文本和设置斜体shape.WordArt.Text = "艺术字效果";shape.WordArt.Italic = true;//设置文字填充样式shape.FillColor = System.Drawing.Color.Red;shape.StrokeColor = System.Drawing.Color.Gray;// Save the document and launch to see the outputSpire.Doc.Documents.Paragraph paragraph2 = document.Sections[0].Paragraphs[2];Spire.Doc.Fields.Footnote footnote = paragraph2.AppendFootnote(FootnoteType.Footnote);DocumentObject obj = null;for (int i = 0; i < paragraph.ChildObjects.Count; i++){obj = paragraph.ChildObjects[i];if (obj.DocumentObjectType == DocumentObjectType.TextRange){TextRange textRange = obj as TextRange;if (textRange.Text == "推箱子"){//为添加脚注的字符串设置加粗格式textRange.CharacterFormat.Bold = true;//插入脚注paragraph.ChildObjects.Insert(i + 1, footnote);break;}}}TextRange text = footnote.TextBody.AddParagraph().AppendText("推箱子是一款来自日本的古老游戏,其设计目的是训练人的逻辑思维能力。游戏场景一般是设定在空间狭小的仓库中,要求把箱子摆放到指定位置。这就要求玩家巧妙的运用有限的空间和通道,合理的安排箱子的位置和移动次序才可能完成任务。");text.CharacterFormat.FontName = "Arial Black";text.CharacterFormat.FontSize = 9;text.CharacterFormat.TextColor = Color.DarkGray;footnote.MarkerCharacterFormat.FontName = "Calibri";footnote.MarkerCharacterFormat.FontSize = 12;footnote.MarkerCharacterFormat.Bold = true;footnote.MarkerCharacterFormat.TextColor = Color.DarkGreen;document.SaveToFile("content.doc", FileFormat.Doc);//System.Diagnostics.Process.Start("text.docx");}catch (Exception e2){MessageBox.Show(e2.Message);}}}
}

添加com引用

使用菜单:项目 -- 添加引用,在 COM 标签页添加名为 "MicrosoftWord 15.0 Object Library" Word 对象互操作库
在程序代码源文件中添加命名空间支持:
using MsWord=Microsoft.Office.Interop.Word;
所有操作 Word 对象的 COM 方法调用代码必须处在在异常处理代码块中,先创建 Word
Application 对象,它是 Word 对象操作的最开始,创建此对象时 WINWORD.EXE 进程启动。
MsWord.Application oWordApplic;//a reference to Wordapplication
MsWord.Document oDoc;//a reference to thedocument
try
{
}
catch (Exception e2)
{
MessageBox.Show(e2.Message);
}
后续所有操作 Word 对象的代码都要处于 Try 语法块中。

检测到旧的 word 档后删除旧文档。

string doc_file_name = Directory.GetCurrentDirectory() + @"\content.doc";
if (File.Exists(doc_file_name))
{
File.Delete(doc_file_name);
}
oWordApplic = new MsWord.Application();
object missing = System.Reflection.Missing.Value;

创建 Word 文档的小节

分节符在 Word 文档中是用来生成小节的控制符,每小节的页眉页脚的内容,页码格式等
保持一致。本项目生成的 Word 文档要求有不同的页码格式和页眉内容,首先插入 4 个分节符获得 5 个小节,第 1 小节是摘要内容,第 2 小节是目录,第 3 小节是第一章,第 4 小节是表 格,第 5 小节是图片。第 1, 2 小节的页码是大写罗马数字,第 3 4 5 小节的页码是阿拉伯 数字,且起始页码为 1

MsWord.Range curRange;
object curTxt;
int curSectionNum = 1;
oDoc = oWordApplic.Documents.Add(ref missing, ref missing, ref missing, ref missing);
oDoc.Activate();
Console.WriteLine(" 正在生成文档小节");
object section_nextPage = MsWord.WdBreakType.wdSectionBreakNextPage;
object page_break = MsWord.WdBreakType.wdPageBreak;
//添加三个分节符,共四个小节
for (int si = 0; si < 4; si++)
{
oDoc.Paragraphs[1].Range.InsertParagraphAfter();
oDoc.Paragraphs[1].Range.InsertBreak(ref section_nextPage);}

相关文章:

使用com组件编辑word

一个普通的窗体应用&#xff0c;6个button using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; u…...

国产Euler(欧拉)系统安装docker

国产的真™难用呀 生态又差还不开源 血泪经验 解压Docker安装包。 tar zxf docker-19.03.10.tgz 将解压后目录中的文件移动到“/usr/bin”下。 cp docker/* /usr/bin配置docker.service文件。 编辑docker.service文件。 vim /usr/lib/systemd/system/docker.service添加以…...

Linux 进程控制

文章目录 进程创建进程终止进程结果wait函数waitpid函数status参数 进程替换进程替换原理进程替换函数 补充/拓展 进程创建 fork函数 #include <unistd.h>pid_t fork(void);函数返回值&#xff1a; 在父进程中&#xff0c;fork函数返回子进程的进程ID&#xff08;PID&…...

[ Linux Audio 篇 ] 音频开发入门基础知识

在短视频兴起的背景下&#xff0c;音视频开发越来越受到重视。接下来将为大家介绍音频开发者入门知识&#xff0c;帮助读者快速了解这个领域。 轻柔的音乐、程序员有节奏感的键盘声、嗡嗡的发动机、刺耳的手提钻……这些声音是如何产生的呢&#xff1f;又是如何传到我们耳中的…...

关于高校电子邮件系统开通双因素认证的经验分享-以清华大学为例

清华大学信息化技术中心 马云龙 作者简介: 马云龙,男,清华大学信息化技术中心高级工程师;Coremail管理员社区大咖嘉宾 深耕高校计算机网络/信息化/网络安全岗位20年,对大规模计算机网络及信息系统规划,开发/建设,运维有深刻体会。 目前,越来越多的高校/企业/政府机关…...

「Swift」类淘宝商品瀑布流展示

前言&#xff1a;需要做一个类似于淘宝商品页面的瀑布流展示 结构分析&#xff1a; ps&#xff1a;图片来源 思路分析&#xff1a; 该瀑布流主要还是基于UICollectionView进行展示&#xff0c;只是在cell展示的UICollectionViewFlowLayout需要进行相应调整和自定义&#xff…...

道可云会展元宇宙平台全新升级,打造3D沉浸式展会新模式

随着VR虚拟现实、人工智能、虚拟数字人等元宇宙技术的快速发展&#xff0c;各个行业正试图通过元宇宙技术寻求新的发展突破口&#xff0c;会展行业也不例外。会展作为经贸领域的重要产业形态&#xff0c;越来越多的企业和组织开始寻求通过元宇宙技术为展会赋能&#xff0c;以满…...

Ant Design Pro初始化报错

今天按照官网步骤初始化项目&#xff0c;第一次报错 fatal: unable to access https://github.com/ant-design/ant-design-pro/: SSL certificate problem: unable to get local issuer certificate 致命&#xff1a;无法访问https://github.com/ant-design/ant-design-pro/&…...

第16届中国R会议暨2023X-AGI大会开幕,和鲸科技分享ModelOps在数据科学平台中的实践与应用

11月25日&#xff0c;第 16 届中国 R 会议暨 2023 X-AGI 大会在在中国人民大学逸夫会堂拉开帷幕&#xff0c;本次会议由中国人民大学统计学院、中国人民大学应用统计科学研究中心、统计之都、原灵科技和中国商业统计学会人工智能分会&#xff08;筹&#xff09;主办&#xff0c…...

❀My学习Linux命令小记录(12)❀

目录 ❀My学习Linux命令小记录&#xff08;12&#xff09;❀ 46.arp指令 47.tcpdump指令 48.chmod指令 49.chown指令 50.bash调用脚本指令 shell介绍 shell脚本的组成部分 脚本执行方式 检查脚本语法 bash之变量 变量的种类&#xff1a;根据生效的范围不同来区分 …...

MySQL学习day05

DCL&#xff08;Data Control Language&#xff09;数据控制语言学习 作用&#xff1a;用来创建数据库用户、控制数据库的访问权限 1&#xff09;查询用户&#xff1a; use mysql; select * from user; 2&#xff09;创建用户&#xff1a; create user 用户名主机名 identifi…...

JAVA面试题7

1.Java中的ClassLoader是什么&#xff1f; 它有什么作用&#xff1f; 答案&#xff1a;ClassLoader是一种加载Java类文件的机制&#xff0c;可以从不同的来源加载类文件&#xff0c;如本地文件系统、网络等。ClassLoader可以帮助实现模块化开发和动态加载类等功能。 2.什么是J…...

好用免费的AI换脸5个工具

在当今社会的发展中&#xff0c;人工智能&#xff08;Artificial Intelligence, AI&#xff09;扮演着关键的角色&#xff0c;其应用领域不断扩展。作为AI的一个分支&#xff0c;换脸技术近年来备受欢迎。这项技术使得将一个人的面部特征迁移到另一个人的照片或视频成为可能。除…...

【Linux】公网远程访问AMH服务器管理面板

目录 1. Linux 安装AMH 面板2. 本地访问AMH 面板3. Linux安装Cpolar4. 配置AMH面板公网地址5. 远程访问AMH面板6. 固定AMH面板公网地址 AMH 是一款基于 Linux 系统的服务器管理面板&#xff0c;它提供了一系列的功能&#xff0c;包括网站管理、FTP 管理、数据库管理、DNS 管理、…...

随笔-这都是命吗

我与鹏哥、小付有个小群&#xff0c;前几天&#xff0c;鹏哥在群里发了一个图&#xff0c;是他那个城市准备扶持的高新产业&#xff0c;有元宇宙、量子信息、生物制药、人工智能什么的。 先前的时候鹏哥给我说过&#xff0c;当地准备了六百多亩地&#xff0c;准备发展高新产业…...

优化网站性能,从容谈CDN加速的部署与运维

随着互联网的迅猛发展&#xff0c;网站的性能优化成为网站运维工作中不可或缺的一环。其中&#xff0c;CDN&#xff08;Content Delivery Network&#xff09;加速技术因其在全球范围内提供快速、可靠的内容分发而备受关注。本文将从一个网站运维的角度出发&#xff0c;深入探讨…...

JavaScript-事件

事件 事件流 指的是事件完整执行过程中的流动路径 两个阶段&#xff1a; 捕获阶段&#xff1a;从大到小冒泡阶段&#xff1a;从小到大 实际开发中都是使用事件冒泡为主 事件捕获 从DOM的根元素开始取执行对应的事件&#xff08;从外到里&#xff09; document.addEventLis…...

linux的磁盘管理

Linux 提供了多种工具和技术来进行磁盘管理。下面是对 Linux 磁盘管理的详细解释&#xff1a; 磁盘和分区&#xff1a; 磁盘&#xff08;硬盘&#xff09;&#xff1a;Linux 系统中的磁盘通常是通过 SATA、SCSI、NVMe 等接口连接的物理硬盘。可以使用工具如 lsblk、fdisk、pa…...

qt-C++笔记之主线程中使用异步逻辑来处理ROS事件循环和Qt事件循环解决相互阻塞的问题

qt-C笔记之主线程中使用异步逻辑来处理ROS事件循环和Qt事件循环解决相互阻塞的问题 code review! 文章目录 qt-C笔记之主线程中使用异步逻辑来处理ROS事件循环和Qt事件循环解决相互阻塞的问题1.Qt的app.exec()详解2.ros::spin()详解3.ros::AsyncSpinner详解4.主线程中结合使用…...

【Docker】从零开始:18.使用Dockerfile构造自己的KingbaseES数据库镜像

【Docker】从零开始&#xff1a;17.使用Dockerfile构造自己的数据库镜像 新建一个自定义目录并创建Dockerfile文件上传需要的文件到自定义目录下注意docker-circle-init.sh文件内容password 内容 开始打包注意打包完成后执行 尝试用工具连接数据库 kingbase.tar.gz 包过大我就上…...

在软件开发中正确使用MySQL日期时间类型的深度解析

在日常软件开发场景中&#xff0c;时间信息的存储是底层且核心的需求。从金融交易的精确记账时间、用户操作的行为日志&#xff0c;到供应链系统的物流节点时间戳&#xff0c;时间数据的准确性直接决定业务逻辑的可靠性。MySQL作为主流关系型数据库&#xff0c;其日期时间类型的…...

【人工智能】神经网络的优化器optimizer(二):Adagrad自适应学习率优化器

一.自适应梯度算法Adagrad概述 Adagrad&#xff08;Adaptive Gradient Algorithm&#xff09;是一种自适应学习率的优化算法&#xff0c;由Duchi等人在2011年提出。其核心思想是针对不同参数自动调整学习率&#xff0c;适合处理稀疏数据和不同参数梯度差异较大的场景。Adagrad通…...

从WWDC看苹果产品发展的规律

WWDC 是苹果公司一年一度面向全球开发者的盛会&#xff0c;其主题演讲展现了苹果在产品设计、技术路线、用户体验和生态系统构建上的核心理念与演进脉络。我们借助 ChatGPT Deep Research 工具&#xff0c;对过去十年 WWDC 主题演讲内容进行了系统化分析&#xff0c;形成了这份…...

Debian系统简介

目录 Debian系统介绍 Debian版本介绍 Debian软件源介绍 软件包管理工具dpkg dpkg核心指令详解 安装软件包 卸载软件包 查询软件包状态 验证软件包完整性 手动处理依赖关系 dpkg vs apt Debian系统介绍 Debian 和 Ubuntu 都是基于 Debian内核 的 Linux 发行版&#xff…...

【论文笔记】若干矿井粉尘检测算法概述

总的来说&#xff0c;传统机器学习、传统机器学习与深度学习的结合、LSTM等算法所需要的数据集来源于矿井传感器测量的粉尘浓度&#xff0c;通过建立回归模型来预测未来矿井的粉尘浓度。传统机器学习算法性能易受数据中极端值的影响。YOLO等计算机视觉算法所需要的数据集来源于…...

镜像里切换为普通用户

如果你登录远程虚拟机默认就是 root 用户&#xff0c;但你不希望用 root 权限运行 ns-3&#xff08;这是对的&#xff0c;ns3 工具会拒绝 root&#xff09;&#xff0c;你可以按以下方法创建一个 非 root 用户账号 并切换到它运行 ns-3。 一次性解决方案&#xff1a;创建非 roo…...

无人机侦测与反制技术的进展与应用

国家电网无人机侦测与反制技术的进展与应用 引言 随着无人机&#xff08;无人驾驶飞行器&#xff0c;UAV&#xff09;技术的快速发展&#xff0c;其在商业、娱乐和军事领域的广泛应用带来了新的安全挑战。特别是对于关键基础设施如电力系统&#xff0c;无人机的“黑飞”&…...

Web后端基础(基础知识)

BS架构&#xff1a;Browser/Server&#xff0c;浏览器/服务器架构模式。客户端只需要浏览器&#xff0c;应用程序的逻辑和数据都存储在服务端。 优点&#xff1a;维护方便缺点&#xff1a;体验一般 CS架构&#xff1a;Client/Server&#xff0c;客户端/服务器架构模式。需要单独…...

绕过 Xcode?使用 Appuploader和主流工具实现 iOS 上架自动化

iOS 应用的发布流程一直是开发链路中最“苹果味”的环节&#xff1a;强依赖 Xcode、必须使用 macOS、各种证书和描述文件配置……对很多跨平台开发者来说&#xff0c;这一套流程并不友好。 特别是当你的项目主要在 Windows 或 Linux 下开发&#xff08;例如 Flutter、React Na…...

第八部分:阶段项目 6:构建 React 前端应用

现在&#xff0c;是时候将你学到的 React 基础知识付诸实践&#xff0c;构建一个简单的前端应用来模拟与后端 API 的交互了。在这个阶段&#xff0c;你可以先使用模拟数据&#xff0c;或者如果你的后端 API&#xff08;阶段项目 5&#xff09;已经搭建好&#xff0c;可以直接连…...