c# 操作word中的表格 批量复制和批量插入

用的是windows自带的dll包,没有引用第三方

1 WordHelper.cs

using System;
using Microsoft.Office.Interop.Word;
using System.Runtime.InteropServices;namespace cadWord
{public class WordHelper{private Microsoft.Office.Interop.Word.Document wDoc = null;private Microsoft.Office.Interop.Word.Application wApp = null;public Microsoft.Office.Interop.Word.Document Document{get { return wDoc; }set { wDoc = value; }}public Microsoft.Office.Interop.Word.Application Application{get { return wApp; }set { wApp = value; }}/// <summary>/// 打开指定WORD文档/// </summary>/// <param name="strFileName"></param>public void Open(string strFileName){wApp = new Microsoft.Office.Interop.Word.ApplicationClass();object fileName = strFileName;object readOnly = false;object isVisible = true;object missing = Type.Missing;wDoc = wApp.Documents.Open(ref fileName, ref missing, ref readOnly,ref missing, ref missing, ref missing, ref missing, ref missing, ref missing,ref missing, ref missing, ref isVisible, ref missing, ref missing, ref missing, ref missing);wDoc.Activate();}#region 从模板创建新的Word文档/// <summary>  /// 从模板创建新的Word文档  /// </summary>  /// <param name="templateName">模板文件名</param>  /// <returns></returns>  public bool CreateNewWordDocument(string templateName){try{return CreateNewWordDocument(templateName, ref wDoc, ref wApp);}catch (Exception ex){throw ex;}}#endregion#region 从模板创建新的Word文档,并且返回对象Document,Application/// <summary>  /// 从模板创建新的Word文档,  /// </summary>  /// <param name="templateName">模板文件名</param>  /// <param name="wDoc">返回的Word.Document对象</param>  /// <param name="WApp">返回的Word.Application对象</param>  /// <returns></returns>  public static bool CreateNewWordDocument(string templateName, ref Microsoft.Office.Interop.Word.Document wDoc, ref  Microsoft.Office.Interop.Word.Application WApp){Microsoft.Office.Interop.Word.Document thisDocument = null;Microsoft.Office.Interop.Word.Application thisApplication = new Microsoft.Office.Interop.Word.Application();/thisApplication.Visible = false;thisApplication.Caption = "";thisApplication.Options.CheckSpellingAsYouType = false;thisApplication.Options.CheckGrammarAsYouType = false;Object Template = templateName;// Optional Object. The name of the template to be used for the new document. If this argument is omitted, the Normal template is used.  Object NewTemplate = false;// Optional Object. True to open the document as a template. The default value is False.  Object DocumentType = Microsoft.Office.Interop.Word.WdNewDocumentType.wdNewBlankDocument; // Optional Object. Can be one of the following WdNewDocumentType constants: wdNewBlankDocument, wdNewEmailMessage, wdNewFrameset, or wdNewWebPage. The default constant is wdNewBlankDocument.  Object Visible = true;//Optional Object. True to open the document in a visible window. If this value is False, Microsoft Word opens the document but sets the Visible property of the document window to False. The default value is True.  try{Microsoft.Office.Interop.Word.Document wordDoc = thisApplication.Documents.Add(ref Template, ref NewTemplate, ref DocumentType, ref Visible);thisDocument = wordDoc;wDoc = wordDoc;WApp = thisApplication;return true;}catch (Exception ex){string err = string.Format("创建Word文档出错,错误原因:{0}", ex.Message);throw new Exception(err, ex);}}#endregion#region 文档另存为其他文件名/// <summary>  /// 文档另存为其他文件名  /// </summary>  /// <param name="fileName">文件名</param>  /// <param name="wDoc">Document对象</param>  public bool SaveAs(string fileName){try{return SaveAs(fileName, wDoc);}catch (Exception ex){throw ex;}}#endregion#region 文档另存为其他文件名/// <summary>  /// 文档另存为其他文件名  /// </summary>  /// <param name="fileName">文件名</param>  /// <param name="wDoc">Document对象</param>  public static bool SaveAs(string fileName, Microsoft.Office.Interop.Word.Document wDoc){Object FileName = fileName; // 文档的名称。默认值是当前文件夹名和文件名。如果文档在以前没有保存过,则使用默认名称(例如,Doc1.doc)。如果已经存在具有指定文件名的文档,则会在不先提示用户的情况下改写文档。  Object FileFormat = Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatDocument; // 文档的保存格式。可以是任何 WdSaveFormat 值。要以另一种格式保存文档,请为 SaveFormat 属性指定适当的值。  Object LockComments = false; // 如果为 true,则锁定文档以进行注释。默认值为 false。  Object Password = System.Type.Missing; // 用来打开文档的密码字符串。(请参见下面的备注。)  Object AddToRecentFiles = false; // 如果为 true,则将该文档添加到“文件”菜单上最近使用的文件列表中。默认值为 true。  Object WritePassword = System.Type.Missing; // 用来保存对文件所做更改的密码字符串。(请参见下面的备注。)  Object ReadOnlyRecommended = false; // 如果为 true,则让 Microsoft Office Word 在打开文档时建议只读状态。默认值为 false。  Object EmbedTrueTypeFonts = false; //如果为 true,则将 TrueType 字体随文档一起保存。如果省略的话,则 EmbedTrueTypeFonts 参数假定 EmbedTrueTypeFonts 属性的值。  Object SaveNativePictureFormat = true; // 如果图形是从另一个平台(例如,Macintosh)导入的,则 true 表示仅保存导入图形的 Windows 版本。  Object SaveFormsData = false; // 如果为 true,则将用户在窗体中输入的数据另存为数据记录。  Object SaveAsAOCELetter = false; // 如果文档附加了邮件程序,则 true 表示会将文档另存为 AOCE 信函(邮件程序会进行保存)。  Object Encoding = System.Type.Missing; // MsoEncoding。要用于另存为编码文本文件的文档的代码页或字符集。默认值是系统代码页。  Object InsertLineBreaks = true; // 如果文档另存为文本文件,则 true 表示在每行文本末尾插入分行符。  Object AllowSubstitutions = false; //如果文档另存为文本文件,则 true 允许 Word 将某些符号替换为外观与之类似的文本。例如,将版权符号显示为 (c)。默认值为 false。  Object LineEnding = Microsoft.Office.Interop.Word.WdLineEndingType.wdCRLF;// Word 在另存为文本文件的文档中标记分行符和换段符。可以是任何 WdLineEndingType 值。  Object AddBiDiMarks = true;//如果为 true,则向输出文件添加控制字符,以便保留原始文档中文本的双向布局。  try{wDoc.SaveAs(ref FileName, ref FileFormat, ref LockComments, ref Password, ref AddToRecentFiles, ref WritePassword, ref ReadOnlyRecommended, ref EmbedTrueTypeFonts, ref SaveNativePictureFormat, ref SaveFormsData, ref SaveAsAOCELetter, ref Encoding, ref InsertLineBreaks, ref AllowSubstitutions, ref LineEnding, ref AddBiDiMarks);return true;}catch (Exception ex){string err = string.Format("另存文件出错,错误原因:{0}", ex.Message);throw new Exception(err, ex);}}#endregion#region 关闭文档/// <summary>  /// 关闭文档  /// </summary>  public void Close(){Close(wDoc, wApp);wDoc = null;wApp = null;}#endregion[DllImport("shell32.dll ")]public static extern int ShellExecute(IntPtr hwnd, String lpszOp, String lpszFile, String lpszParams, String lpszDir, int FsShowCmd);#region 关闭文档/// <summary>  /// 关闭文档  /// </summary>  /// <param name="wDoc">Document对象</param>  /// <param name="WApp">Application对象</param>  public static void Close(Microsoft.Office.Interop.Word.Document wDoc, Microsoft.Office.Interop.Word.Application WApp){Object SaveChanges = Microsoft.Office.Interop.Word.WdSaveOptions.wdSaveChanges;// 指定文档的保存操作。可以是下列 WdSaveOptions 值之一:wdDoNotSaveChanges、wdPromptToSaveChanges 或 wdSaveChanges。  Object OriginalFormat = Microsoft.Office.Interop.Word.WdOriginalFormat.wdOriginalDocumentFormat;// 指定文档的保存格式。可以是下列 WdOriginalFormat 值之一:wdOriginalDocumentFormat、wdPromptUser 或 wdWordDocument。  Object RouteDocument = false;// 如果为 true,则将文档传送给下一个收件人。如果没有为文档附加传送名单,则忽略此参数。  try{if (wDoc != null) wDoc.Close(ref SaveChanges, ref OriginalFormat, ref RouteDocument);if (WApp != null) WApp.Quit(ref SaveChanges, ref OriginalFormat, ref RouteDocument);}catch (Exception ex){throw ex;}}#endregion#region 填充书签/// <summary>  /// 填充书签  /// </summary>  /// <param name="bookmark">书签</param>  /// <param name="value">值</param>  public void Replace(string bookmark, string value){try{object bkObj = bookmark;if (wApp.ActiveDocument.Bookmarks.Exists(bookmark) == true){wApp.ActiveDocument.Bookmarks.get_Item(ref bkObj).Select();}else return;wApp.Selection.TypeText(value);}catch (Exception ex){throw ex;}}#endregionpublic bool FindTable(string bookmarkTable){try{object bkObj = bookmarkTable;if (wApp.ActiveDocument.Bookmarks.Exists(bookmarkTable) == true){wApp.ActiveDocument.Bookmarks.get_Item(ref bkObj).Select();return true;}elsereturn false;}catch (Exception ex){throw ex;}}public void MoveNextCell(){try{Object unit = Microsoft.Office.Interop.Word.WdUnits.wdCell;Object count = 1;wApp.Selection.Move(ref unit, ref count);}catch (Exception ex){throw ex;}}public void tableInsertRows(int i, int j, int count, int k){Microsoft.Office.Interop.Word.Table newTable = wDoc.Tables[k];for (int jj = 0; jj < count; jj++){object beforeRow = newTable.Cell(i, j).Range;newTable.Rows.Add(ref beforeRow);}}public void SetWordCellValue(int i, int j, int k, string value){try{Microsoft.Office.Interop.Word.Table newTable = wDoc.Tables[k];newTable.Cell(i, j).Range.Text = value;}catch (Exception ex){throw ex;}}/// <summary>/// 插入图片/// </summary>/// <param name="i"></param>/// <param name="j"></param>/// <param name="k"></param>/// <param name="strPicPath"></param>public void InsertImage(int i, int j, int k, string strPicPath){Microsoft.Office.Interop.Word.Table newTable = wDoc.Tables[k];string FileName = strPicPath;object LinkToFile = false;object SaveWithDocument = true;object Anchor = newTable.Cell(i, j).Range;wApp.ActiveDocument.InlineShapes.AddPicture(FileName, ref LinkToFile, ref SaveWithDocument, ref Anchor).Select();}public void SetCellValue(string value){try{wApp.Selection.Rows.Alignment = WdRowAlignment.wdAlignRowCenter;wApp.Selection.TypeText(value);wApp.Selection.Rows.Alignment = WdRowAlignment.wdAlignRowCenter;}catch (Exception ex){throw ex;}}public string GetCellValue(){try{string value = wApp.Selection.Text;if (value.Length <= 2){return "";}elsereturn value;}catch (Exception ex){throw ex;}}public void MoveNextRow(){try{Object extend = Microsoft.Office.Interop.Word.WdMovementType.wdExtend;Object unit = Microsoft.Office.Interop.Word.WdUnits.wdCell;Object count = 1;wApp.Selection.MoveRight(ref unit, ref count, ref extend);}catch (Exception ex){throw ex;}}//获取word文件的文本内容public string DocToText(string docFileName, out Font xx){//实例化COM        Application Word_App = new Application();/object fileobj = docFileName;object nullobj = System.Reflection.Missing.Value;//打开指定文件(不同版本的COM参数个数有差异,//一般而言除第一个外都用nullobj就行了)Document wd = Word_App.Documents.Open(ref fileobj, ref nullobj, ref nullobj, ref nullobj,ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj,ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj,ref nullobj, ref nullobj);//取得doc文件中的文本内容string outText = wd.Content.Text;xx = wd.Content.Font;//关闭文件wd.Close(ref nullobj, ref nullobj, ref nullobj);//关闭COMWord_App.Quit(ref nullobj, ref nullobj, ref nullobj);//返回文本内容return outText;}/// <summary>/// 复制模板中已经存放的表,并生成其后位置不定数量的表/// </summary>/// <param name="_tableIndex">对象表</param>/// <param name="_row">表后位置,即计算其行列数也能得出数字</param>/// <param name="_tableNum">表数量</param>public void copyTableInsert(int _tableIndex, object _row, int _tableNum){//--start-#根据表序号索引,获取对象表#-->Microsoft.Office.Interop.Word.Table copyTable = wDoc.Tables[_tableIndex];//--start-#复制该对象表#-->copyTable.Range.Copy();//复制一下//--start-#让光标选中该对象表#-->copyTable.Select();//--start-#不允许表跨页断行#-->copyTable.AllowPageBreaks = false;object what = Microsoft.Office.Interop.Word.WdGoToItem.wdGoToLine;object which = Microsoft.Office.Interop.Word.WdGoToDirection.wdGoToNext;object missing = Type.Missing;//--start-#让光标移至表后#-->wApp.Selection.GoTo(ref what, ref which, ref _row, ref missing);//--start-#计算生成的表数量#-->for (int i = 0; i < _tableNum; i++){//--start-#表后插入分页符#-->wApp.Selection.InsertBreak(ref missing);//--start-#复制表生成#-->wApp.Selection.Paste();}// Microsoft.Office.Interop.Word.Table copyTable = wDoc.Tables[3];// copyTable.Range.Copy();//复制一下// copyTable.Select();//选中表对象,此时光标已经在这张表格上了// copyTable.AllowPageBreaks = false;// //复制后的第一张表:实验室2// object what = Microsoft.Office.Interop.Word.WdGoToItem.wdGoToLine;// object which = Microsoft.Office.Interop.Word.WdGoToDirection.wdGoToNext;// object missing = Type.Missing;// //  object count = 36;//光标下移3格// wApp.Selection.GoTo(ref what, ref which, ref _row, ref missing);// // wApp.Selection.Range.Text = "单体建筑核实比对表2\n";//插入文本// wApp.Selection.GoTo(ref what, ref which, 1, ref missing);//光标下移1格,不和被测科室这个文本在一块,另起一行// wApp.Selection.Paste();//粘贴表// //复制后的第一张表:实验室2// //what = Microsoft.Office.Interop.Word.WdGoToItem.wdGoToLine;// //which = Microsoft.Office.Interop.Word.WdGoToDirection.wdGoToNext;wApp.Selection.Range.Text = "被测科室:实验室2\n";//插入文本// wApp.Selection.GoTo(ref what, ref which, 1, ref missing);//光标下移1格,不和被测科室这个文本在一块,另起一行// wApp.Selection.Paste();//粘贴表}}
}

2 核心代码

  /// <summary>/// 复制模板中已经存放的表,并生成其后位置不定数量的表/// </summary>/// <param name="_tableIndex">对象表</param>/// <param name="_row">表后位置,即计算其行列数也能得出数字</param>/// <param name="_tableNum">表数量</param>public void copyTableInsert(int _tableIndex, object _row, int _tableNum){//--start-#根据表序号索引,获取对象表#-->Microsoft.Office.Interop.Word.Table copyTable = wDoc.Tables[_tableIndex];//--start-#复制该对象表#-->copyTable.Range.Copy();//复制一下//--start-#让光标选中该对象表#-->copyTable.Select();//--start-#不允许表跨页断行#-->copyTable.AllowPageBreaks = false;object what = Microsoft.Office.Interop.Word.WdGoToItem.wdGoToLine;object which = Microsoft.Office.Interop.Word.WdGoToDirection.wdGoToNext;object missing = Type.Missing;//--start-#让光标移至表后#-->wApp.Selection.GoTo(ref what, ref which, ref _row, ref missing);//--start-#计算生成的表数量#-->for (int i = 0; i < _tableNum; i++){//--start-#表后插入分页符#-->wApp.Selection.InsertBreak(ref missing);//--start-#复制表生成#-->wApp.Selection.Paste();}// Microsoft.Office.Interop.Word.Table copyTable = wDoc.Tables[3];// copyTable.Range.Copy();//复制一下// copyTable.Select();//选中表对象,此时光标已经在这张表格上了// copyTable.AllowPageBreaks = false;// //复制后的第一张表:实验室2// object what = Microsoft.Office.Interop.Word.WdGoToItem.wdGoToLine;// object which = Microsoft.Office.Interop.Word.WdGoToDirection.wdGoToNext;// object missing = Type.Missing;// //  object count = 36;//光标下移3格// wApp.Selection.GoTo(ref what, ref which, ref _row, ref missing);// // wApp.Selection.Range.Text = "单体建筑核实比对表2\n";//插入文本// wApp.Selection.GoTo(ref what, ref which, 1, ref missing);//光标下移1格,不和被测科室这个文本在一块,另起一行// wApp.Selection.Paste();//粘贴表// //复制后的第一张表:实验室2// //what = Microsoft.Office.Interop.Word.WdGoToItem.wdGoToLine;// //which = Microsoft.Office.Interop.Word.WdGoToDirection.wdGoToNext;wApp.Selection.Range.Text = "被测科室:实验室2\n";//插入文本// wApp.Selection.GoTo(ref what, ref which, 1, ref missing);//光标下移1格,不和被测科室这个文本在一块,另起一行// wApp.Selection.Paste();//粘贴表}

3 调用代码

批量插入表格后,原理就是整个文档会从前到后编制表格索引,从一开始意思是前面序号为1.2.3表格,1复制3个在后面,那么原先的2表格序号就标为2+3=5!为表格设置各种值也是按这个序号来!

  private void button1_Click(object sender, EventArgs e){string mbPath = System.IO.Path.Combine(Application.StartupPath + "\\MB", "测量报告样本.docx");//模板string savePath = @"C:\Users\54061\Desktop\333\test\测量报告样本.docx";//保存路径//string imagePath = @"C:\Users\54061\Desktop\彭泽军\test\江西省工程有限公司(公章).png";//保存路径File.Copy(mbPath, savePath, true);WordHelper wordhelper = new WordHelper();wordhelper.Open(savePath);//--start-#计算生成的表#-->wordhelper.copyTableInsert(3, 32, 5);wordhelper.copyTableInsert(4 + 5, 4, 5);wordhelper.copyTableInsert(5 + 5 + 5, 14, 5);//--start-#计算单体建筑核实比对表#-->wordhelper.Close();MessageBox.Show("导出完成!");}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/124410.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

C# “依赖注入” 中的 “三种生命周期”

&#x1f680;简介 依赖注入&#xff08;Dependency Injection&#xff0c;简称DI&#xff09;是一种实现控制反转&#xff08;IoC&#xff09;的技术&#xff0c;用于减少代码之间的耦合度。通过依赖注入&#xff0c;一个类可以从外部获取其依赖的对象&#xff0c;而不是自己…

如何理解AutoGPT

AutoGPT和GPT-4都是OpenAI公司的产品。AutoGPT是一个实验性开源应用程序&#xff0c;展示了GPT-4语言模型的能力。GPT-4是OpenAI研发的人工智能语言模型。 AutoGPT在GitHub主页上有151k星&#xff08;151k星代表了151,000个用户点赞了该项目&#xff09;&#xff0c;AutoGPT获…

Hudi系列文章7-RFC24 Flink 写入流程优化

文章目录 前言问题背景瓶颈与解决方案瓶颈一解决方法工作流程&#xff1a;精准一次语义容灾CoorinatorCheckpoint如何配合使用StreamWriteOperatorCoordinator CheckpointedFunctionStreamWriteFunctionInstant 提前生成问题 瓶颈二问题解决方案BucketAssignerBucketWriter 重点…

Kubernetes概述及其组件/核心组件

目录 1、K8S 是什么&#xff1f; 2、为什么要用 K8S? 3、k8s的特性 4、Kubernetes 集群架构与组件 5、核心组件 Master 组件 ●Kube-apiserver ●Kube-controller-manager ●Kube-scheduler 配置存储中心 ●etcd Node 组件 ●Kubelet ●Kube-Proxy ●docker 或…

Java自学者怎么写简历?

Java自学者怎么写简历&#xff1f; 首先&#xff0c;有技术实力的人绝对不会问这个问题。虽然你是自学的&#xff0c;但是一定要有项目&#xff01;没有项目都是空谈。最近很多小伙伴找我&#xff0c;说想要一些Java资料&#xff0c;然后我根据自己从业十年经验&#xff0c;熬夜…

中间件安全-CVE 复现K8sDockerJettyWebsphere漏洞复现

目录 服务攻防-中间件安全&CVE 复现&K8s&Docker&Jetty&Websphere中间件-K8s中间件-Jetty漏洞复现CVE-2021-28164-路径信息泄露漏洞CVE-2021-28169双重解码信息泄露漏洞CVE-2021-34429路径信息泄露漏洞 中间件-Docker漏洞复现守护程序 API 未经授权访问漏洞…

Python beautifulsoup模块简介及安装

视频版教程&#xff1a;一天掌握python爬虫【基础篇】 涵盖 requests、beautifulsoup、selenium 简单来说&#xff0c;Beautiful Soup 是 python 的一个库&#xff0c;最主要的功能是从网页抓取数据。官方解释如下&#xff1a; Beautiful Soup 提供一些简单的、python 式的函…

个人服务器怎么搭建?个人服务器搭建方法

​  个人服务器是指一台由个人拥有和管理的服务器&#xff0c;用于存储和提供个人网站、应用程序或其他在线服务。搭建个人服务器可以让我们更好地掌控自己的数据和网络资源。下面介绍一种常见的个人服务器搭建方法。 第一步&#xff1a;选择合适的硬件 我们需要选择一台适合…

uniapp表单验证

以下是一个简单的uniapp表单验证示例&#xff1a; <template><view class"uni-form"><view class"uni-form-item"><view class"uni-form-label">用户名</view><input type"text" v-model"user…

逻辑回归

逻辑回归 二分类情况 对于二分类问题&#xff0c;在线性可分的情况下&#xff0c;试图构建一个判别式 W ′ X ′ b {WXb} W′X′b&#xff0c;为了便于操作将判别式增广为 W X {WX} WX。 W x i { > 0 , x i ∈ w 1 , Y 1 < 0 , x i ∈ w 2 , Y 0 {Wx_i}\begin{cas…

PyTorch入门学习(六):神经网络的基本骨架使用

目录 一、引言 二、创建神经网络骨架 三、执行前向传播 一、引言 神经网络是深度学习的基础。在PyTorch中&#xff0c;可以使用nn.Module类创建自定义神经网络模型。本文将演示如何创建一个简单的神经网络骨架并执行前向传播操作。 二、创建神经网络骨架 首先&#xff0c…

Spring Boot 优雅配置yml配置文件定义集合、数组和Map

一、value 获取配置文件 在平时的yml配置文件中&#xff0c;我们经常使用到配置基本数据类型的字符串&#xff0c;比如配置日志文件的写法如下&#xff1a; # 配置日志输出级别 logging:# 指定logback配置文件的位置 config: classpath:logback-spring.xml# 文件日志要输出的路…

SpringBoot可以连接RabbitMQ集群吗 ?

目录 一、SpringBoot可以连接RabbitMQ集群吗&#xff1f;二、springboot连接到rabbitmq集群可以负载均衡吗&#xff1f;三、SpringBoot既然可以配置负载均衡&#xff0c;为什么还需要Haproxy做负载均衡&#xff1f; 一、SpringBoot可以连接RabbitMQ集群吗&#xff1f; Spring …

Java14-16新特性

目录 一、Java14新特性 1、instanceof模式匹配 2、友好的空指针(NullPointerException)提示 3、record类型 二、Java15新特性 1、Sealed Classes 2、CharSequence新增方法 3、TreeMap新增方法 4、文本块 5、无需配置环境变量 三、Java16新特性 1、包装类构造方法的…

Sketch mac 98.3(矢量绘图设计软件)

Sketch是一款专为Mac设计的矢量图形编辑软件&#xff0c;被广泛应用于UI/UX设计、网页设计、移动应用设计等领域。Sketch提供了各种工具和功能&#xff0c;包括绘图、图形设计、排版等&#xff0c;可以帮助设计师轻松地创建高质量的矢量图形和模型。Sketch的主要特点包括&#…

Git基础命令实践

文章目录 简介git的安装配置git的安装git的配置 git使用的基本流程创建版本库时光机穿梭版本回退工作区和暂存区管理修改撤销修改删除文件 远程仓库添加远程库从远程库克隆 总结 简介 本文主要记录了我在学习git操作的过程&#xff0c;以及如何使用GitHub。建议先参考廖雪峰的…

测试环境内存溢出排查过程

基本信息 客户名称&#xff1a;xxx 产品名称&#xff1a; 版本号&#xff1a; 问题分类&#xff1a;编码问题 环境类型&#xff1a;实体机 问题现象 保险公司测试环境爆内存&#xff0c;机器挂掉。总共64g的内存&#xff0c;在没有开始测试tomcat部署war包前内存使用率为25%左…

debian和ubuntu

Debian和Ubuntu是两种流行的Linux发行版&#xff0c;它们之间有密切的关系&#xff0c;但也存在一些重要的区别。 关系&#xff1a; Ubuntu是基于Debian创建的。这意味着Ubuntu使用与Debian相同的APT包管理系统&#xff0c;并共享来自Debian库中的大量包和库。 区别&#xf…

提升管理文件效率:批量删除文件名中的特殊符号

在文件管理的过程中&#xff0c;我们经常会遇到文件名中包含特殊符号的情况&#xff0c;这些符号可能会干扰文件的正常运行&#xff0c;特别是在一些特定的软件或系统中。因此&#xff0c;为了提高文件管理的效率和文件的可读性、可操作性&#xff0c;我们需要对这些特殊符号进…

[BUUCTF NewStarCTF 2023 公开赛道] week4 crypto/pwn

再补完这个就基本上完了. crypto RSA Variation II Schmidt-Samoa密码系统看上去很像RSA,其中Npqq, 给的eN给了d from secret import flag from Crypto.Util.number import *p getPrime(1024) q getPrime(1024)N p*p*qd inverse(N, (p-1)*(q-1)//GCD(p-1, q-1))m bytes…