/* * * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * - Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * - Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * - Neither the name of Oracle nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
void loadDocument() {
createStyles(); for (int i = 0; i < data.length; i++) {
Paragraph p = data[i];
addParagraph(p);
}
}
void addParagraph(Paragraph p) { try {
Style s = null; for (int i = 0; i < p.data.length; i++) {
Run run = p.data[i];
s = runAttr.get(run.attr);
doc.insertString(doc.getLength(), run.content, s);
}
Run(String attr, String content) { this.attr = attr; this.content = content;
}
String attr;
String content;
}
Paragraph[] data = new Paragraph[] { new Paragraph("title", new Run[] { new Run("none", "Hello from Cupertino")
}), new Paragraph("title", new Run[] { new Run("none", "\u53F0\u5317\u554F\u5019\u60A8\u0021")
}), new Paragraph("title", new Run[] { new Run("none", "\u0391\u03B8\u03B7\u03BD\u03B1\u03B9\u0020"// Greek
+ "\u03B1\u03C3\u03C0\u03B1\u03B6\u03BF\u03BD"
+ "\u03C4\u03B1\u03B9\u0020\u03C5\u03BC\u03B1"
+ "\u03C2\u0021")
}), new Paragraph("title", new Run[] { new Run("none", "\u6771\u4eac\u304b\u3089\u4eca\u65e5\u306f")
}), new Paragraph("title", new Run[] { new Run("none", "\u05e9\u05dc\u05d5\u05dd \u05de\u05d9\u05e8\u05d5"
+ "\u05e9\u05dc\u05d9\u05dd")
}), new Paragraph("title", new Run[] { new Run("none", "\u0633\u0644\u0627\u0645")
}), };
}
¤ Dauer der Verarbeitung: 0.18 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.