public class MinimalHTMLWriter extends AbstractWriter
< <类型> <!——命名样式列表p.normal {字体家庭:SansSerif;边缘高度:0;字体大小:14}-->< /样式>< /头> <鱼> < P风格=正常> 粗体、斜体和下划线的属性,运行的是发出的HTML标签。剩余的属性被释放为“跨越”标签的样式属性的一部分。的语法类似于内联样式。< / >< /身体>< / 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()
这已不再使用,取而代之的是“跨度”将被写出来。
|
protected boolean |
inFontTag()
如果我们当前处于“字体”标签,则返回真。
|
protected boolean |
isText(Element elem)
如果元素是一个文本元素,则返回真。
|
protected void |
startFontTag(String style)
这已不再使用,取而代之的是“跨度”将被写出来。
|
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()
写出和
<样式>
标签,然后调用writestyles()写出所有的命名方式为
<样式>
标签的内容。
样式>
样式>
|
protected void |
writeHTMLTags(AttributeSet attr)
生成粗体
,斜体 标签,并根据其属性设置文本。
|
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()
将所有已命名的样式写入“样式”标签的内容。
|
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, writeLineSeparator
public 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
-
protected void writeHeader() throws IOException
IOException
-
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
为 <字体> 标签写一个结束标记。 字体>
IOException
-任何I/O错误
protected void startFontTag(String style) throws IOException
为 <字体> 标签写一个开始标记。由于字体标记不能嵌套,该方法在写出一个新的开始标记之前关闭任何封闭的字体标签。 字体>
IOException
-任何I/O错误
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.