public class MinimalHTMLWriter extends AbstractWriter
  <html>
   <head>
     <style>
        <!-- list of named styles
         p.normal {
            font-family: SansSerif;
            margin-height: 0;
            font-size: 14
         }
        -->
      </style>
   </head>
   <body>
    <p style=normal>
        Bold, italic, and underline attributes of the run are emitted as HTML tags. The remaining attributes are emitted as part of the style attribute of a <span> tag. The syntax is similar to inline styles.
    </p>
   </body>
 </html>  
      NEWLINE| Constructor and Description | 
|---|
| MinimalHTMLWriter(Writer w, StyledDocument doc)
              创建一个新的MinimalHTMLWriter。 
             | 
| MinimalHTMLWriter(Writer w, StyledDocument doc, int pos, int len)
              创建一个新的MinimalHTMLWriter。 
             | 
| Modifier and Type | Method and Description | 
|---|---|
| protected void | endFontTag()
              这不再使用,而是会写出<span>。 
             | 
| protected boolean | inFontTag()
              如果我们目前使用的是<font>标签,则返回true。 
             | 
| protected boolean | isText(Element elem)
              如果元素是文本元素,则返回true。 
             | 
| protected void | startFontTag(String style)
              这不再使用,而是会写出<span>。 
             | 
| protected void | text(Element elem)
              写出文字。 
             | 
| void | write()
              从StyledDocument生成HTML输出。 
             | 
| protected void | writeAttributes(AttributeSet attr)
              写出以下类型的所有属性:StyleConstants.ParagraphConstants,StyleConstants.CharacterConstants,StyleConstants.FontConstants,StyleConstants.ColorConstants。 
             | 
| protected void | writeBody()
              迭代文档中的元素,并基于它们是分支元素还是叶元素来处理元素。 
             | 
| protected void | writeComponent(Element elem) 
             负责处理元件; 
             故意未实施。 
             | 
| protected void | writeContent(Element elem, boolean needsIndenting)
              以符合HTML的方式写入属性集。 
             | 
| protected void | writeEndParagraph()
              发出<p>标签的结束标记。 
             | 
| protected void | writeEndTag(String endTag)
              写出一个适合缩进的结束标签。 
             | 
| protected void | writeHeader()
              写出<head>和<style>标签,然后调用writeStyles()将所有命名样式写成<style>标签的内容。 
             | 
| protected void | writeHTMLTags(AttributeSet attr)
              根据其属性设置为文本生成粗体<b>,斜体<i>和<u>标签。 
             | 
| protected void | writeImage(Element elem) 
             负责处理图标元素; 
             故意未实施。 
             | 
| protected void | writeLeaf(Element elem)
              负责写出其他非文本元素。 
             | 
| protected void | writeNonHTMLAttributes(AttributeSet attr)
              以符合HTML的方式写出剩余的字符级属性(粗体,斜体和下划线之外的属性)。 
             | 
| protected void | writeStartParagraph(Element elem)
              发出段落的起始标记。 
             | 
| protected void | writeStartTag(String tag)
              写出一个适当缩进的开始标签。 
             | 
| protected void | writeStyles()
              将所有命名的样式写成<style>标签的内容。 
             | 
decrIndent, getCanWrapLines, getCurrentLineLength, getDocument, getElementIterator, getEndOffset, getIndentLevel, getIndentSpace, getLineLength, getLineSeparator, getStartOffset, getText, getWriter, incrIndent, indent, inRange, isLineEmpty, output, setCanWrapLines, setCurrentLineLength, setIndentSpace, setLineLength, setLineSeparator, write, write, write, writeLineSeparatorpublic MinimalHTMLWriter(Writer w, StyledDocument doc)
w - 作家 
           doc - StyledDocument 
           public MinimalHTMLWriter(Writer w, StyledDocument doc, int pos, int len)
w - 作家 
           doc - StyledDocument 
           pos - 文档中获取内容的位置。 
           len - 写出的金额。 
           public void write()
           throws IOException,
                  BadLocationException 
          write在 
            AbstractWriter 
           IOException - 在任何I / O错误 
           BadLocationException - 如果pos表示文档中的无效位置。 
           protected void writeAttributes(AttributeSet attr) throws IOException
writeAttributes在 
            AbstractWriter 
           attr - 一个AttributeSet。 
           IOException - 任何I / O错误 
           protected void text(Element elem) throws IOException, BadLocationException
text在 
            AbstractWriter 
           elem - 一个元素。 
           IOException - 在任何I / O错误 
           BadLocationException - 如果pos表示文档中的无效位置。 
           protected void writeStartTag(String tag) throws IOException
IOException - 任何I / O错误 
           protected void writeEndTag(String endTag) throws IOException
IOException - 在任何I / O错误 
           protected void writeHeader()
                    throws IOException 
          IOException - 在任何I / O错误 
           protected void writeStyles()
                    throws IOException 
          IOException - 任何I / O错误 
           protected void writeBody()
                  throws IOException,
                         BadLocationException 
          IOException - 在任何I / O错误 
           BadLocationException 
           protected void writeEndParagraph()
                          throws IOException 
          IOException - 在任何I / O错误 
           protected void writeStartParagraph(Element elem) throws IOException
IOException - 对任何I / O错误 
           protected void writeLeaf(Element elem) throws IOException
IOException - 任何I / O错误 
           protected void writeImage(Element elem) throws IOException
elem - StyleConstants.IconElementName类型的元素 
           IOException 
           protected void writeComponent(Element elem) throws IOException
IOException 
           protected boolean isText(Element elem)
protected void writeContent(Element elem, boolean needsIndenting) throws IOException, BadLocationException
IOException - 任何I / O错误 
           BadLocationException - 如果pos表示文档中的无效位置。 
           protected void writeHTMLTags(AttributeSet attr) throws IOException
IOException - 在任何I / O错误 
           protected void writeNonHTMLAttributes(AttributeSet attr) throws IOException
IOException - 在任何I / O错误 
           protected boolean inFontTag()
protected void endFontTag()
                   throws IOException 
          写出<font>标签的结束标签。
IOException - 在任何I / O错误 
           protected void startFontTag(String style) throws IOException
写出<font>标签的开始标签。 由于字体标签无法嵌套,因此此方法会在写出新的开始标记之前关闭任何封闭的字体标签。
IOException - on any I/O error 
            Submit a bug or feature 
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
 Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.