indent word pt word
摘要:如何利用C 实现word段落首行缩进1 5厘米1,连接word就不说了2,dim wAd As Microsoft Office Interop Word DocumentWith wAd Style...
发布日期:2020-09-25如何利用C#实现word段落首行缩进1.5厘米
1,连接word就不说了2,dim wAd As Microsoft.Office.Interop.Word.DocumentWith wAd.Styles(jieName).ParagraphFormat.LeftIndent = wAd.Application.CentimetersToPoints(0)"整行缩进0个字符.FirstLineIndent = wAd.Application.CentimetersToPoints(0.35)"首行缩进0.35个字符.OutlineLevel = Microsoft.Office.Interop.Word.WdOutlineLevel.wdOutlineLevel1.CharacterUnitLeftIndent = 0.CharacterUnitRightIndent = 0.CharacterUnitFirstLineIndent = 2"带编号,首行缩进2个字符.LineUnitBefore = 0.LineUnitAfter = 0.MirrorIndents = False.TextboxTightWrap = Microsoft.Office.Interop.Word.WdTextboxTightWrap.wdTightNone.AutoAdjustRightIndent = True.DisableLineHeightGrid = False.FarEastLineBreakControl = True.WordWrap = True.HangingPunctuation = True.HalfWidthPunctuationOnTopOfLine = False.AddSpaceBetweenFarEastAndAlpha = True.AddSpaceBetweenFarEastAndDigit = True.BaseLineAlignment =Microsoft.Office.Interop.Word.WdBaselineAlignment.wdBaselineAlignAutoEnd With3,剩下自己摸索吧,呵呵。
star indent side by 什么意思?
用vba代码可以实现。
下面这段代码是设置文字格式的,根据标题序号的不同,设置不同的格式。
供参考!Private Sub CommandButton4_Click() "排版格式 Dim T_WORD As String Dim RNG As Range Dim mypra As Paragraph Set mydic = CreateObject("Scripting.Dictionary") "二级标题字符 mydic.Add "一", 1 mydic.Add "二", 1 mydic.Add "三", 1 mydic.Add "四", 1 mydic.Add "五", 1 mydic.Add "六", 1 mydic.Add "七", 1 mydic.Add "八", 1 mydic.Add "九", 1 mydic.Add "十", 1 T_WORD = TextBox1.Text 导出路径文件名 = ThisDocument.Path & "\" & T_WORD Set mydoc = Documents.Open(导出路径文件名) mydoc.Activate Selection.WholeStory "选中全部 Selection.ClearFormatting "清除全部格式 zz = 0"For Each mypra In ActiveDocument.Paragraphs For Each mypra In mydoc.Paragraphs If Not mypra.Range.Information(wdWithInTable) = True Then "非表格段落 zz = zz + 1 MYSTR = mypra.Range.Text mychar = Mid(MYSTR, 1, 1) "mypra.Select If zz = 1 Or zz = 2 Then "一级标题 黑体 小二 是 居中 1行 1行 固定值18磅 无 With mypra .Range.Font.Name = "黑体" .Range.Font.Size = 18 "(小二高度18磅) .Range.Font.Bold = True .Range.ParagraphFormat.Alignment = wdAlignParagraphCenter .Range.ParagraphFormat.LineUnitBefore = 1 .Range.ParagraphFormat.LineUnitAfter = 1".Range.ParagraphFormat.SpaceBefore = 10.5 "段前 1123修改为5号10.5磅 ".Range.ParagraphFormat.SpaceAfter = 10.5 "段后 .FirstLineIndent = 0 "首行缩进无 .LineSpacingRule = wdLineSpaceExactly ".LineSpacingRule = wdLineSpace1pt5 .Range.ParagraphFormat.LineSpacing = 18 "行间距18磅 End With Else If mydic.Exists(mychar) Then "二级标题 黑体 小四 是 两端对齐 1行 1行 固定值18磅 首行缩进2字符 With mypra .Range.Font.Name = "黑体" .Range.Font.Size = 12 .Range.Font.Bold = True .Range.ParagraphFormat.Alignment = wdAlignParagraphJustify .Range.ParagraphFormat.LineUnitBefore = 1 .Range.ParagraphFormat.LineUnitAfter = 1 ".Range.ParagraphFormat.SpaceBefore = 10.5 "段前 小四高度=12磅 1123修改为5号10.5磅 ".Range.ParagraphFormat.SpaceAfter = 10.5 "段后 ".FirstLineIndent = CentimetersToPoints(1.27) "首行缩进2字符 0.635*2=1.27 .FirstLineIndent = CentimetersToPoints(0.74) "首行缩进2字符 0.74 和正文相同 " .LineSpacingRule = wdLineSpace1pt5 .LineSpacingRule = wdLineSpaceExactly .Range.ParagraphFormat.LineSpacing = 18 "行间距18磅 End With Else "正文 宋体 五号 否 两端对齐 0行 0.5行 固定值18磅 首行缩进2字符 With mypra .Range.Font.Name = "宋体" .Range.Font.Size = 10.5 .Range.Font.Bold = False .Range.ParagraphFormat.Alignment = wdAlignParagraphJustify ".Range.ParagraphFormat.SpaceBefore = 0 "段前0 ".Range.ParagraphFormat.SpaceAfter = 5.25 "段后0.5*10.5=5.25 .Range.ParagraphFormat.LineUnitBefore = 0 .Range.ParagraphFormat.LineUnitAfter = 0.5.FirstLineIndent = CentimetersToPoints(0.74) "0.37*2=0.74 .LineSpacingRule = wdLineSpaceExactly .Range.ParagraphFormat.LineSpacing = 18 "行间距18磅 .Alignment = wdAlignParagraphJustify End With If zz = 3 Then "第3段落居中 With mypra .Range.ParagraphFormat.Alignment = wdAlignParagraphCenter End With End If End If End If End If Next mypra mydoc.Save mydoc.Close False "关闭word文档 Set mydoc = Nothing "清空工作簿项目 End Sub
如何在Word2007中使用Endnote
1. 安装了word 与 Endnote 却不见其出现在Word工具栏中。
2. 点击word中的office按钮,在底部点击“word 选项”。
选择左侧的“加载项”,在底部管理栏的下拉菜单中选“word加载项”,点击旁边的“转到”。
进入小窗口后检查EndNote Cwyw.dot;EndNote Web Cwyw.dot;EndNote Cwyw.dotm 和 EndNote Web Cwyw.dotm 都被选中。
如果没有其中的加载项,则通过路径“C:\Program Files\EndNote X1\Product-Support\CWYW”在这个文件夹里可以找到,并将其添加。
3. 再进入“word 选项”,选择“加载项”下拉菜单中的“禁用项目”。
如果有EndNote Cwyw的项目已被禁用,则选中并启用。
确定修改后重新启动word,问题应该已经解决了
圆心在抛物线x2=2y上,并且和抛物线的准线及y轴都相切的圆的标准方...
请在每一行 With Selection.ParagraphFormat 的后面添加以下一行:.Reset将所有的段落格式清除,然后用后续的代码重新设置即可。
以下是完整的、精简后的代码:Sub set_write_simple()With Selection.ParagraphFormat.Reset.OutlineLevel = wdOutlineLevel1.CharacterUnitLeftIndent = 0.CharacterUnitRightIndent = 0.CharacterUnitFirstLineIndent = 0End WithSelection.TypeText Text:="一级" "这句话没有缩进,正常Selection.TypeParagraphWith Selection.ParagraphFormat.Reset.OutlineLevel = wdOutlineLevelBodyText.CharacterUnitLeftIndent = 6.CharacterUnitRightIndent = 0.CharacterUnitFirstLineIndent = 2End WithSelection.TypeText Text:="正文" "这句话做了段落缩进和首行缩进,正常Selection.TypeParagraphWith Selection.ParagraphFormat.Reset.OutlineLevel = wdOutlineLevel1.CharacterUnitLeftIndent = 0.CharacterUnitRightIndent = 0.CharacterUnitFirstLineIndent = 0End WithSelection.TypeText Text:="一级" "这句话显示异常,本没有任何缩进却缩进了。
End Sub
首行缩进快捷键 word如何设置首行缩进快捷键
具体操作:文件选项自定义功能区键盘快捷键自定义在类别里下拉找所有命令右边的命令里找IndentFirstLine下边按新的快捷键可以自己认定,我按的ctrl+J点左下角的指定后关闭即可。
这样设置后按快捷键设置后,在段落里看到的是缩进的尺寸(厘米),这个跟你的字体大小是关联的,与2字符是一样的效果。
word代码改变文本格式
text-align, text-indent,word-spacing列表相关属性:list-style-image,font-variant, font-weight, text-transform, letter-spacing,其他的都不可被继承,line-height, font:文本相关属性:font-family, font-size, font-style以下的都是可以被继承的,除了这些之外
poi的word转html,如何显示修订内容的最终状态
实现代码如下:public class Word2Html { public static void main(String argv[]) { try { //word 路径 html输出路径 convert2Html("D:/doctohtml/1.doc","D:/doctohtml/1.html"); } catch (Exception e) { e.printStackTrace(); } } public static void writeFile(String content, String path) { FileOutputStream fos = null; BufferedWriter bw = null; try { File file = new File(path); fos = new FileOutputStream(file); bw = new BufferedWriter(new OutputStreamWriter(fos,"utf-8")); bw.write(content); } catch (FileNotFoundException fnfe) { fnfe.printStackTrace(); } catch (IOException ioe) { ioe.printStackTrace(); } finally { try { if (bw != null) bw.close(); if (fos != null) fos.close(); } catch (IOException ie) { } } } public static void convert2Html(String fileName, String outPutFile) throws TransformerException, IOException, ParserConfigurationException { HWPFDocument wordDocument = new HWPFDocument(new FileInputStream(fileName));//WordToHtmlUtils.loadDoc(new FileInputStream(inputFile)); WordToHtmlConverter wordToHtmlConverter = new WordToHtmlConverter( DocumentBuilderFactory.newInstance().newDocumentBuilder() .newDocument()); wordToHtmlConverter.setPicturesManager( new PicturesManager() { public String savePicture( byte[] content, PictureType pictureType, String suggestedName, float widthInches, float heightInches ) { //html 中 图片标签中 显示的图片路路径 return "d:/doctohtml/"+suggestedName; } } ); wordToHtmlConverter.processDocument(wordDocument); //save pictures List pics=wordDocument.getPicturesTable().getAllPictures(); if(pics!=null){ for(int i=0;i Picture pic = (Picture)pics.get(i); System.out.println(); try { //word中图片的存储路径 pic.writeImageContent(new FileOutputStream("D:/doctohtml/" + pic.suggestFullFileName())); } catch (FileNotFoundException e) { e.printStackTrace(); } } } Document htmlDocument = wordToHtmlConverter.getDocument(); ByteArrayOutputStream out = new ByteArrayOutputStream(); DOMSource domSource = new DOMSource(htmlDocument); StreamResult streamResult = new StreamResult(out); TransformerFactory tf = TransformerFactory.newInstance(); Transformer serializer = tf.newTransformer(); serializer.setOutputProperty(OutputKeys.ENCODING, "utf-8"); serializer.setOutputProperty(OutputKeys.INDENT, "yes"); serializer.setOutputProperty(OutputKeys.METHOD, "html"); serializer.transform(domSource, streamResult); out.close(); writeFile(new String(out.toByteArray()), outPutFile); } }