word vba自动化排版-设置标题模板样式、标题、正文、图表、页面、上下标等设置、删除空白行、删除分页符分节符、删除空格等

word vba自动化排版-设置标题模板样式、标题、正文、图表、页面、上下标等设置、删除空白行、删除分页符分节符、删除空格等

目录

1.前提

2.思路

3.word中设置

4.效果图

5.经验教训

6.直接上代码


1.前提

        需求:工作中涉及自动识别大量的文字报告(ocr完成),然后对报告进行排版,手动排版效率超级慢,因此探索了一下word vba自动排版

        参考:chatgpt、word vba官网文档、这篇博客csdn、这篇博客知乎、还有上下标的博客不知出处

        注意:不要期望别人都给代码注释好这个参数、这个函数是什么作用什么意思,像CentimetersToPoints、CharacterUnitFirstLineIndent等等,去官网文档查看一下才最有深刻印象。

着重理解官网文档selection、activedocument的关联,以及word 对象之间的关联(主要看对象属性里面有哪些 跳转一下查看),像inlinshape.range.ParagraphFormat嵌入式图片的段落样式设置等等。。。

2.思路

       先了解一下基础语法!

        ①对于标题模板样式、段落文字的样式设置 主要用录制宏来实现,基于此修改代码

        ②对于find、段落、document、selection等的函数参数要去官网查看文档

        ③对于删除分页符等参考的chatgpt,国内的大模型不行

        ④对于上下标,参考的不知出处的博客-感谢

        ⑤设置图表样式 参考官网、博客、chatgpt

        录制宏不是万能的,对于删除分页符、设置图表样式这样的操作,录制宏的代码单独执行不起作用!

        若想精通熟练使用vba进行排版,还是需要去官网了解vba的对象结构,以及函数用法。

        直接上手用,若复杂操作会比较依赖chatgpt,实际上很多参数不知道啥作用,查看官方文档需要较长时间理解。

        代码可以在wps中运行,但是样式有的不尽人意。

3.word中设置

        ①先设置 开发工具:文件->选项->信任中心设置->启用宏

        ②打开 开发工具->vb编辑器->工具->引用->勾选“Microsoft VBScript Regular Expressions 5.5”

4.效果图

        TODO

5.经验教训

        ①对于段落(非图表)参数越多越好,参数之间会互相影响(使用录制宏)

        ②对于图表,参数不一定越多越好,有的参数互相影响,导致效果有问题

6.直接上代码

        涉及:设置标题图片模板样式、标题、正文、图表、页面、上下标等样式、删除空白行、删除分页符分节符、删除空格等

Sub 设置标题正文模板样式1()
'
' 设置标题正文模板样式 宏
' 设置2级标题、正文的字体段落、图片样式模板
'With ActiveDocument.Styles(wdStyleHeading2).Font.NameFarEast = "宋体".NameAscii = "Times New Roman".NameOther = "Times New Roman".Name = "Times New Roman".Size = 22.Bold = False.Italic = False.Underline = wdUnderlineNone.UnderlineColor = wdColorAutomatic.StrikeThrough = False.DoubleStrikeThrough = False.Outline = False.Emboss = False.Shadow = False.Hidden = False.SmallCaps = False.AllCaps = False.Color = wdColorAutomatic.Engrave = False.Superscript = False.Subscript = False.Scaling = 100.Kerning = 1.Animation = wdAnimationNone.DisableCharacterSpaceGrid = False.EmphasisMark = wdEmphasisMarkNone.Ligatures = wdLigaturesNone.NumberSpacing = wdNumberSpacingDefault.NumberForm = wdNumberFormDefault.StylisticSet = wdStylisticSetDefault.ContextualAlternates = 0End WithWith ActiveDocument.Styles(wdStyleHeading2).ParagraphFormat.LeftIndent = CentimetersToPoints(0).RightIndent = CentimetersToPoints(0).SpaceBefore = 0.SpaceBeforeAuto = False.SpaceAfter = 0.SpaceAfterAuto = False.LineSpacingRule = wdLineSpaceSingle.Alignment = wdAlignParagraphCenter.WidowControl = False.KeepWithNext = False.KeepTogether = True.PageBreakBefore = True.NoLineNumber = False.Hyphenation = True.FirstLineIndent = CentimetersToPoints(0).OutlineLevel = wdOutlineLevel2.CharacterUnitLeftIndent = 0.CharacterUnitRightIndent = 0.CharacterUnitFirstLineIndent = 0.LineUnitBefore = 0.LineUnitAfter = 0.MirrorIndents = False.TextboxTightWrap = wdTightNone.CollapsedByDefault = False.AutoAdjustRightIndent = True.DisableLineHeightGrid = False.FarEastLineBreakControl = True.WordWrap = True.HangingPunctuation = True.HalfWidthPunctuationOnTopOfLine = False.AddSpaceBetweenFarEastAndAlpha = True.AddSpaceBetweenFarEastAndDigit = True.BaseLineAlignment = wdBaselineAlignAutoEnd WithActiveDocument.Styles(wdStyleHeading2).NoSpaceBetweenParagraphsOfSameStyle = FalseWith ActiveDocument.Styles(wdStyleHeading2).AutomaticallyUpdate = False.BaseStyle = wdStyleNormal.NextParagraphStyle = wdStyleNormalEnd With'新建 图片样式 判断是否存在On Error Resume Next  ' 暂时禁用错误处理styleExists = Not (ActiveDocument.Styles("图片样式") Is Nothing)On Error GoTo 0       ' 恢复正常的错误处理If Not styleExists ThenActiveDocument.Styles.Add Name:="图片样式", Type:=wdStyleTypeParagraphEnd IfActiveDocument.Styles("图片样式").AutomaticallyUpdate = TrueWith ActiveDocument.Styles("图片样式").Font.NameFarEast = "宋体".NameAscii = "Times New Roman".NameOther = "Times New Roman".Name = "Times New Roman".Size = 10.5.Bold = False.Italic = False.Underline = wdUnderlineNone.UnderlineColor = wdColorAutomatic.StrikeThrough = False.DoubleStrikeThrough = False.Outline = False.Emboss = False.Shadow = False.Hidden = False.SmallCaps = False.AllCaps = False.Color = wdColorAutomatic.Engrave = False.Superscript = False.Subscript = False.Scaling = 100.Kerning = 1.Animation = wdAnimationNone.DisableCharacterSpaceGrid = False.EmphasisMark = wdEmphasisMarkNone.Ligatures = wdLigaturesNone.NumberSpacing = wdNumberSpacingDefault.NumberForm = wdNumberFormDefault.StylisticSet = wdStylisticSetDefault.ContextualAlternates = 0End WithWith ActiveDocument.Styles("图片样式").ParagraphFormat.LeftIndent = CentimetersToPoints(0).RightIndent = CentimetersToPoints(0).SpaceBefore = 0.SpaceBeforeAuto = False.SpaceAfter = 0.SpaceAfterAuto = False.LineSpacingRule = wdLineSpaceSingle.Alignment = wdAlignParagraphCenter.WidowControl = False.KeepWithNext = True.KeepTogether = True.PageBreakBefore = True.NoLineNumber = False.Hyphenation = True.FirstLineIndent = CentimetersToPoints(0).CharacterUnitLeftIndent = 0.CharacterUnitRightIndent = 0.CharacterUnitFirstLineIndent = 0.OutlineLevel = wdOutlineLevelBodyText.LineUnitBefore = 0.LineUnitAfter = 0.MirrorIndents = False.TextboxTightWrap = wdTightNone.CollapsedByDefault = False.AutoAdjustRightIndent = True.DisableLineHeightGrid = False.FarEastLineBreakControl = True.WordWrap = True.HangingPunctuation = True.HalfWidthPunctuationOnTopOfLine = False.AddSpaceBetweenFarEastAndAlpha = True.AddSpaceBetweenFarEastAndDigit = True.BaseLineAlignment = wdBaselineAlignAutoEnd WithActiveDocument.Styles("图片样式").NoSpaceBetweenParagraphsOfSameStyle = FalseActiveDocument.Styles("图片样式").ParagraphFormat.TabStops.ClearAllWith ActiveDocument.Styles("图片样式").ParagraphFormatWith .Shading.Texture = wdTextureNone.ForegroundPatternColor = wdColorAutomatic.BackgroundPatternColor = wdColorAutomaticEnd With.Borders(wdBorderLeft).LineStyle = wdLineStyleNone.Borders(wdBorderRight).LineStyle = wdLineStyleNone.Borders(wdBorderTop).LineStyle = wdLineStyleNone.Borders(wdBorderBottom).LineStyle = wdLineStyleNoneWith .Borders.DistanceFromTop = 1.DistanceFromLeft = 4.DistanceFromBottom = 1.DistanceFromRight = 4.Shadow = FalseEnd WithEnd WithActiveDocument.Styles("图片样式").Frame.DeleteMsgBox "标题正文模板样式设置完成"
End SubSub 设置页面参数2()
'
'设置初始化:取消所有样式、设置页边距、设置纸张大小、页眉页脚边距、每页行数、每行字数、设置所有段落为正文样式
'Selection.WholeStorySelection.ClearFormattingSelection.Range.HighlightColorIndex = wdNoHighlightWith ActiveDocument.PageSetup.LineNumbering.Active = False.Orientation = wdOrientPortrait.TopMargin = CentimetersToPoints(2.54).BottomMargin = CentimetersToPoints(2.54).LeftMargin = CentimetersToPoints(3.17).RightMargin = CentimetersToPoints(3.17).Gutter = CentimetersToPoints(0).HeaderDistance = CentimetersToPoints(1.5).FooterDistance = CentimetersToPoints(1.75).PageWidth = CentimetersToPoints(21).PageHeight = CentimetersToPoints(29.7).FirstPageTray = wdPrinterDefaultBin.OtherPagesTray = wdPrinterDefaultBin.SectionStart = wdSectionNewPage.OddAndEvenPagesHeaderFooter = False.DifferentFirstPageHeaderFooter = False.VerticalAlignment = wdAlignVerticalTop.SuppressEndnotes = False.MirrorMargins = False.TwoPagesOnOne = False.BookFoldPrinting = False.BookFoldRevPrinting = False.BookFoldPrintingSheets = 1.GutterPos = wdGutterPosLeft.CharsLine = 39.LinesPage = 44.LayoutMode = wdLayoutModeGridEnd With' 设置正文样式Selection.Style = ActiveDocument.Styles(wdStyleNormal)Selection.HomeKey Unit:=wdStoryMsgBox "页面参数样式设置完成"End SubSub 删除空白行3()
'
'先执行删除空白行(不可等设置完样式后再执行),再将全文所有空格删除
'Dim para As ParagraphDim isBlank As BooleanFor Each para In ActiveDocument.ParagraphsisBlank = TrueIf Len(para.Range.text) <> 1 ThenisBlank = FalseEnd IfIf para.Range.Information(wdWithInTable) = False ThenIf isBlank Thenpara.Range.DeleteEnd IfEnd IfNextActiveDocument.Content.Find.Execute FindText:=" ", ReplaceWith:="", Replace:=wdReplaceAllMsgBox "已删除所有空白行(非表格内)、空格"
End SubSub 删除分页符4_1()
'chatgpt生成 需要去了解While .Execute用法、Collapse 等Application.ScreenUpdating = FalseApplication.DisplayAlerts = FalseSelection.HomeKey Unit:=wdStoryDim rng As RangeSet rng = ActiveDocument.ContentDim regEx As ObjectSet regEx = CreateObject("VBScript.RegExp")With regEx.Global = True.pattern = "\d+"End WithWith rng.Find.ClearFormatting.text = "^m".Forward = True.Wrap = wdFindStopWhile .ExecuteDim lineText As StringlineText = rng.Paragraphs(1).Range.textIf regEx.test(lineText) ThenDim matches As ObjectSet matches = regEx.Execute(lineText)If matches.Count > 0 Thenrng.Paragraphs(1).Range.DeleteEnd IfEnd Ifrng.Collapse Direction:=wdCollapseEndrng.MoveStart Unit:=wdCharacter, Count:=1WendEnd WithEnd SubSub 删除分节符4_2()Application.ScreenUpdating = FalseApplication.DisplayAlerts = FalseSelection.HomeKey Unit:=wdStoryDim rng As RangeSet rng = ActiveDocument.ContentDim regEx As ObjectSet regEx = CreateObject("VBScript.RegExp")With regEx.Global = True.pattern = "\d+"End WithWith rng.Find.ClearFormatting.text = "^b".Forward = True.Wrap = wdFindStopWhile .ExecuteDim lineText As StringlineText = rng.Paragraphs(1).Range.textIf regEx.test(lineText) ThenDim matches As ObjectSet matches = regEx.Execute(lineText)If matches.Count > 0 Thenrng.Paragraphs(1).Range.DeleteEnd IfEnd Ifrng.Collapse Direction:=wdCollapseEndrng.MoveStart Unit:=wdCharacter, Count:=1WendEnd WithActiveDocument.Content.Find.Execute FindText:="^b", ReplaceWith:="", Replace:=wdReplaceAll '删除分节符ActiveDocument.Content.Find.Execute FindText:="^m", ReplaceWith:="", Replace:=wdReplaceAll '删除分页符End SubSub 删除分页符分节符4()Call 删除分页符4_1Call 删除分节符4_2MsgBox "已删除所有分页符分节符"
End SubSub 遍历设置各级段落样式5()
'
'遍历每个段落 逐段落进行标题匹配设置样式
'Application.ScreenUpdating = FalseApplication.DisplayAlerts = FalseSelection.HomeKey Unit:=wdStoryDim t2_reg, t3_reg, t4_reg, t5_reg, t6_reg, t7_reg, cankao_regSet t2_reg = CreateObject("vbscript.regexp")t2_reg.pattern = "^(第[一二三四五六七八九十 ]+篇[^\r]*)\r"Set t3_reg = CreateObject("vbscript.regexp")Dim para As ParagraphDim isSearched As BooleanDim pos As LongFor Each para In ActiveDocument.Paragraphs'用if-elseif更好-不想改了isSearched = FalseIf t2_reg.test(para.Range.text) And Not isSearched ThenisSearched = Truepara.Style = ActiveDocument.Styles(wdStyleHeading2)pos = InStr(para.Range.text, "篇") + 1para.Range.Characters(pos).InsertBefore " " '此段落一定有篇End IfNextSelection.HomeKey Unit:=wdStoryMsgBox "遍历设置各级段落样式完成"End SubSub 设置各级标题样式5()
'不推荐-慢
'采用正则匹配,然后查找设置对应的段落格式
'https://devbox.cn/p/Zai_vba_Zhong_di_460e0cc1.html(非对象不使用set,需要提前Dim声明,对象需要set,可不Dim声明)
'可简化成1个函数,传参遍历执行-但不想!
'Application.ScreenUpdating = FalseApplication.DisplayAlerts = FalseDim t2_reg, t3_reg, t4_reg, t5_reg, t6_reg, t7_reg, strA$  '最后1个$ 只对strA有效strA = ActiveDocument.Content.textSet t2_reg = CreateObject("vbscript.regexp")'二级标题Selection.HomeKey Unit:=wdStoryt2_reg.pattern = "\r(第[一二三四五六七八九十 ]+篇[^\r]*)\r"t2_reg.Global = TrueSet t2_titles = t2_reg.Execute(strA)For Each t2_title In t2_titlesWith Selection.Find.ClearFormatting.text = t2_title.SubMatches(0).Execute Forward:=TrueEnd WithSelection.Style = ActiveDocument.Styles(wdStyleHeading2)Selection.HomeKey Unit:=wdStoryNextMsgBox "标题正文样式设置完成"
End SubSub 设置图表样式6()
'
'设置图表样式
'Application.ScreenUpdating = FalseApplication.DisplayAlerts = FalseDim mytable As TableFor Each mytable In ActiveDocument.TablesWith mytable.TopPadding = PixelsToPoints(0, True).BottomPadding = PixelsToPoints(0, True).LeftPadding = PixelsToPoints(0, True).RightPadding = PixelsToPoints(0, True).Spacing = PixelsToPoints(0, True).AllowPageBreaks = True.AllowAutoFit = TrueWith .Rows.WrapAroundText = False.Alignment = wdAlignRowCenter.AllowBreakAcrossPages = False.HeightRule = wdRowHeightExactly.Height = CentimetersToPoints(0).LeftIndent = CentimetersToPoints(0)End WithWith .RangeWith .Font.Name = "宋体".Name = "Times New Roman".Color = wdColorAutomatic.Size = 7.5.Kerning = 0.DisableCharacterSpaceGrid = TrueEnd WithWith .ParagraphFormat.CharacterUnitFirstLineIndent = 0.FirstLineIndent = CentimetersToPoints(0).LineSpacingRule = wdLineSpaceSingle.Alignment = wdAlignParagraphCenter.AutoAdjustRightIndent = False.DisableLineHeightGrid = True.LeftIndent = CentimetersToPoints(0).RightIndent = CentimetersToPoints(0).FirstLineIndent = CentimetersToPoints(0).CharacterUnitLeftIndent = 0.CharacterUnitRightIndent = 0.CharacterUnitFirstLineIndent = 0End With.Cells.VerticalAlignment = wdCellAlignVerticalCenterEnd With.PreferredWidthType = wdPreferredWidthPoints.PreferredWidth = CentimetersToPoints(14.5)With .Borders.InsideLineStyle = wdLineStyleSingle.OutsideLineStyle = wdLineStyleSingle.InsideLineWidth = wdLineWidth025pt.OutsideLineWidth = wdLineWidth025pt.InsideColor = wdColorAutomatic.OutsideColor = wdColorAutomaticEnd WithEnd WithNextSelection.HomeKey Unit:=wdStoryDim ishape As InlineShapeFor Each ishape In ActiveDocument.InlineShapesWith ishapeIf .Type = wdInlineShapePicture Then.LockAspectRatio = msoTrue.Width = CentimetersToPoints(14.5)End IfEnd Withishape.Range.Style = ActiveDocument.Styles("图片样式")NextDim sh As ShapeFor Each sh In ActiveDocument.ShapesWith shIf .Type = msoPicture Then.LockAspectRatio = msoTrue.Width = CentimetersToPoints(14.5)End IfEnd WithWith Selection.ParagraphFormat.LeftIndent = CentimetersToPoints(0).RightIndent = CentimetersToPoints(0).FirstLineIndent = CentimetersToPoints(0)End WithNextSelection.HomeKey Unit:=wdStoryMsgBox "图表样式设置完成"End SubPrivate Sub SetSuperscriptAndSubscript(ByVal PrefixChr As String, ByVal SetChr As String, Optional ByVal PostChr As String, Optional ByVal SuperscriptMode As Boolean = True)'程序功能:设置文档中特定字符为上标或下标。'参数说明:'PrefixChr:必选参数,要设置为上、下标字符之前的字符;'SetChr:必选参数,要设置为上、下标的字符;'PostChr:必选,但可赋空字符串,若为了界定整个替换符号而包含的后缀,防止误替换,可加此参数'SuperscriptMode:可选参数,设置为 True 表示将 SetChr 设置为上标,设置为 False 表示将 SetChr 设置为下标,默认为 True。Selection.Start = ActiveDocument.Paragraphs(1).Range.StartSelection.Collapse wdCollapseStartWith Selection.Find.ClearFormatting.MatchCase = False.Replacement.ClearFormatting.text = PrefixChr & SetChr & PostChr.Replacement.text = .textIf SuperscriptMode Then.Replacement.Font.Superscript = TrueElse.Replacement.Font.Subscript = TrueEnd If.Execute Replace:=wdReplaceAll.ClearFormatting.Replacement.ClearFormatting.text = PrefixChrIf SuperscriptMode Then.Font.Superscript = TrueElse.Font.Subscript = TrueEnd If.Replacement.text = .textIf SuperscriptMode Then.Replacement.Font.Superscript = FalseElse.Replacement.Font.Subscript = FalseEnd If.Execute Replace:=wdReplaceAllIf Len(PostChr) > 0 Then.ClearFormatting.Replacement.ClearFormatting.text = PostChrIf SuperscriptMode Then.Font.Superscript = TrueElse.Font.Subscript = TrueEnd If.Replacement.text = .textIf SuperscriptMode Then.Replacement.Font.Superscript = FalseElse.Replacement.Font.Subscript = FalseEnd If.Execute Replace:=wdReplaceAllEnd IfEnd With
End SubSub 执行上下标7()
'
'依靠SetSuperscriptAndSubscript来实现
'Call SetSuperscriptAndSubscript("O", "+", "", True)Call SetSuperscriptAndSubscript("O", "-", "", True)Call SetSuperscriptAndSubscript("H", "2", "O", False)Call SetSuperscriptAndSubscript("TiO", "2", "", False)MsgBox "设置上下标完成"
End SubSub 数字智能自动排版流程_遍历段落()MsgBox "这种遍历更快更好-磊磊"Call 设置标题正文模板样式1Call 设置页面参数2Call 删除空白行3Call 删除分页符分节符4Call 遍历设置各级段落样式5Call 设置图表样式6Call 执行上下标7MsgBox "已全部设置完成-磊磊"
End Sub

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

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

相关文章

实验笔记之——基于TUM-RGBD数据集的SplaTAM测试

之前博客对SplaTAM进行了配置&#xff0c;并对其源码进行解读。 学习笔记之——3D Gaussian SLAM&#xff0c;SplaTAM配置&#xff08;Linux&#xff09;与源码解读-CSDN博客SplaTAM全称是《SplaTAM: Splat, Track & Map 3D Gaussians for Dense RGB-D SLAM》&#xff0c;…

NAT配置

IPV4地址中在A/B/C三的单播地址中&#xff0c;还存在私有ip 与公有的区分&#xff1b; 公有&#xff1a;具有全球唯一性&#xff0c;可以在互联网中通讯&#xff0c;需要付费使用 私有&#xff1a;具有本地唯一性&#xff0c;不能在互联网中通信&#xff0c;无需付费使用 私…

在红墙下的冬日幻想:Pygame库实现下雪动画

在红墙下的冬日幻想&#xff1a;借助Pygame库实现下雪动画 寒风轻拂着故宫红墙&#xff0c;我静静地思念着你。这个冬天&#xff0c;借助 Python 的 Pygame 库&#xff0c;我为你呈现一场梦幻般的下雪动画&#xff0c;让雪花在故宫红墙的映衬下在屏幕上翩翩起舞。 准备 首先…

【C++】:STL序列式容器list源码剖析

一、list概述 总的来说&#xff1a;环形双向链表 特点&#xff1a; 底层是使用链表实现的&#xff0c;支持双向顺序访问 在list中任何位置进行插入和删除的速度都很快 不支持随机访问&#xff0c;为了访问一个元素&#xff0c;必须遍历整个容器 与其他容器相比&#xff0c;额外…

【AI预测】破晓未来教育市场:如何精准定位、精选师资并启动高潜力培训项目

在当前全球化和技术快速迭代的背景下&#xff0c;各行业正面临巨大的人才缺口和新的发展机遇。 全球化浪潮&#xff0c;各行业如同搭乘上了一列高速列车&#xff0c;不断深入探索并广泛应用AI技术以提升产业效率、创新服务模式。在智能制造领域&#xff0c;工业4.0时代犹如给…

理解pytorch系列:transpose是怎么实现的

在PyTorch中&#xff0c;transpose()是一种操作&#xff0c;它交换张量中两个指定维度的位置。实现这一点的关键在于不实际移动数据&#xff0c;而是通过改变张量的元数据&#xff08;包括步长&#xff08;stride&#xff09;和尺寸&#xff08;size&#xff09;&#xff09;来…

【leetcode】消失的数字

大家好&#xff0c;我是苏貝&#xff0c;本篇博客带大家刷题&#xff0c;如果你觉得我写的还不错的话&#xff0c;可以给我一个赞&#x1f44d;吗&#xff0c;感谢❤️ 目录 1.暴力求解法2.采用异或的方法&#xff08;同单身狗问题&#xff09;3.先求和再减去数组元素 点击查看…

react的redux和router的使用案例讲解

react的redux和router的使用案例讲解 安装依赖&#xff1a; 首先&#xff0c;你需要安装一些必要的依赖项。使用以下命令安装Redux、React Redux和React Router&#xff1a; npm install redux react-redux react-router-dom配置Redux Store&#xff1a; 创建一个Redux store来…

Linux grep命令(grep指令)grep --help各选项介绍(待更)

文章目录 grep --help英文中文 使用示例-E, --extended-regexp&#xff1a;此选项表示模式为扩展正则表达式。-F, --fixed-strings&#xff1a;此选项表示模式被视为固定字符串而不是正则表达式。-G, --basic-regexp&#xff1a;此选项表示模式为基础正则表达式。这是默认的模式…

Rust之旅 - Rust概念、Windows安装、环境配置

&#x1f339;作者主页&#xff1a;青花锁 &#x1f339;简介&#xff1a;Java领域优质创作者&#x1f3c6;、Java微服务架构公号作者&#x1f604; &#x1f339;简历模板、学习资料、面试题库、技术互助 &#x1f339;文末获取联系方式 &#x1f4dd; 系列专栏目录 [Java项目…

【C++初阶】第二站:类与对象(上) -- 上部分

前言: C学习的第二站&#xff1a;类和对象(上)文章的上半部分,知识点:面向过程和面向对象初步认识、类的引入、类的定义、类的访问限定符及封装、类的作用域、类的实例化. 目录 面向过程和面向对象初步认识 类的引入 类的定义 类的访问限定符及封装 访问限定符 封装 类的…

深入理解Linux文件系统

&#x1f3ac;慕斯主页&#xff1a;修仙—别有洞天 ♈️今日夜电波&#xff1a;晴る—ヨルシカ 0:20━━━━━━️&#x1f49f;──────── 4:30 &#x1f504; ◀️ ⏸ ▶️ ☰ &…

防火墙技术

防火墙&#xff08;英语&#xff1a;Firewall&#xff09;技术是通过有机结合各类用于安全管理与筛选的软件和硬件设备&#xff0c;帮助计算机网络于其内、外网之间构建一道相对隔绝的保护屏障&#xff0c;以保护用户资料与信息安全性的一种技术。 防火墙技术的功能主要在于及…

springboot log4j配置xml实例说明

提供样本配置代码 xml <?xml version"1.0" encoding"UTF-8"?> <!--日志级别以及优先级排序: OFF > FATAL > ERROR > WARN > INFO > DEBUG > TRACE > ALL --> <!-- status log4j2内部日志级别 --> <configurat…

ARP协议及ARP欺骗

ARP英文全称是Address Resolution Protocol&#xff0c;中文称为地址解析协议&#xff0c;是根据IP地址获取物理地址的一个TCP/IP协议。 ARP欺骗全称为ARP spoofing&#xff0c;又称ARP毒化 (ARPpoisoning&#xff0c;网上上多译为ARP病毒)或ARP攻击&#xff0c;是针对以太网地…

开发需求总结9-el-tree获取选中节点,节点全选时返回被全选子级的父节点,未全选则返回被选中的节点

目录 需求描述 代码实现&#xff1a; 需求描述 需要获取树组件选中的节点&#xff0c;假如父节点被选中&#xff08;该节点全选&#xff09;&#xff0c;即只返回父节点的数据&#xff0c;如父节点未被全选&#xff0c;则正常返回被选中节点的数据。 示例一&#xff1a; 如上图…

【学习记录24】vue3自定义指令

一、在单vue文件中直接使用 1、html部分 <template><divstyle"height: 100%;"v-loading"loading"><ul><li v-for"item in data">{{item}} - {{item * 2}}</li></ul></div> </template> 2、js…

基于YOLOv8深度学习的智能肺炎诊断系统【python源码+Pyqt5界面+数据集+训练代码】深度学习实战

《博主简介》 小伙伴们好&#xff0c;我是阿旭。专注于人工智能、AIGC、python、计算机视觉相关分享研究。 ✌更多学习资源&#xff0c;可关注公-仲-hao:【阿旭算法与机器学习】&#xff0c;共同学习交流~ &#x1f44d;感谢小伙伴们点赞、关注&#xff01; 《------往期经典推…

CentOS stream 9配置网卡

CentOS stream9的网卡和centos 7的配置路径&#xff1a;/etc/sysconfig/network-scripts/ifcfg-ens32不一样。 CentOS stream 9的网卡路径&#xff1a; /etc/NetworkManager/system-connections/ens32.nmconnection 方法一&#xff1a; [connection] idens32 uuid426b60a4-4…

2024 CKA 题库 | 11、创建 PVC

不等更新题库 文章目录 11、创建 PVC题目:考点&#xff1a;参考链接:解答:更换 context创建 pvc创建 pod修改 pvc 并记录 11、创建 PVC 题目: 设置配置环境&#xff1a; [candidatenode-1] $ kubectl config use-context ok8sTask 创建一个新的 PersistentVolumeClaim&#x…