Merge branch 'master' into bbmaster

This commit is contained in:
Helmut Merz 2012-02-07 09:33:21 +01:00
commit cc8584f957
4 changed files with 124 additions and 3 deletions

View file

@ -93,7 +93,7 @@
('width: %s;;' % (width and str(width)+'px' or '600px')) + ('width: %s;;' % (width and str(width)+'px' or '600px')) +
'height: 1.5em;;'; 'height: 1.5em;;';
value data/?name|string:; value data/?name|string:;
required field/required_js;" /> xxrequired field/required_js;" />
</metal:textline> </metal:textline>

View file

@ -20,6 +20,7 @@
View definitions for generation of documents. View definitions for generation of documents.
""" """
import os
from zope.app.pagetemplate import ViewPageTemplateFile from zope.app.pagetemplate import ViewPageTemplateFile
from zope.cachedescriptors.property import Lazy from zope.cachedescriptors.property import Lazy
from zope.publisher.browser import BrowserPage from zope.publisher.browser import BrowserPage
@ -40,6 +41,7 @@ class Base(BrowserPage):
class WordDocument(Base): class WordDocument(Base):
index = word_template index = word_template
showLinks = False
def setHeader(self, data, filename='document'): def setHeader(self, data, filename='document'):
fn = '%s.doc' % filename fn = '%s.doc' % filename
@ -57,3 +59,12 @@ class WordDocument(Base):
<w:DoNotOptimizeForBrowser /> <w:DoNotOptimizeForBrowser />
</w:WordDocument> </w:WordDocument>
</xml>""" </xml>"""
@Lazy
def css(self):
fn = os.path.join(os.path.dirname(__file__), 'word.css')
f = open(fn, 'r')
css = f.read()
f.close()
return css

110
docgen/word.css Normal file
View file

@ -0,0 +1,110 @@
body {
font-family: Arial,Helvetica,"sans serif";
font-size: 12pt;
}
body div {
font-size: 12pt;
}
h1, h2, h3, h4, h5, h6, {
color: black;
font-weight: bold;
border: none;
}
h1, h2, h3, h4 {
margin-top: 1em;
}
h4 {
font-style: italic;
}
h5 {
font-size: 120%;
margin-top: 0.5em;
margin-bottom: 0.5em;
}
h6 {
font-size: 100%;
margin-top: 0.5em;
margin-bottom: 0;
}
p {
margin-top: 0.5em;
margin-bottom: 0.5em;
}
li, div {
margin-top: 0.2em;
margin-bottom: 0.2em;
}
.center {
text-align: center;
}
.number {
text-align: right;
}
table {
border-collapse: collapse;
}
td, th {
border: solid 1px #000000;
vertical-align: top;
}
th {
font-weight: normal;
text-align: center;
padding-left: 10px;
padding-right: 10px;
background-color: #eeeeee;
}
.headline1 {
font-weight: bold;
font-size: 140%;
}
.headline2 {
font-weight: bold;
}
span.MsoFootnoteReference {
mso-style-noshow:yes;
vertical-align: super;
}
p.MsoFootnoteText {
font-size: 80%;
margin-left: 3em;
}
@page Section1 {
size: 595.3pt 841.9pt;
margin: 2cm 2cm 2cm 2cm;
mso-header: h1;
mso-footer: f1;
}
div.Section1 {page: Section1}
@page Section2 {
size: 841.9pt 595.3pt;
margin: 2cm 2cm 2cm 2cm;
mso-page-orientation: landscape;
mso-header: h1;
mso-footer: f1;
}
div.Section2 {page: Section2}
@page Section3 {
}
div.Section3 {page: Section3}

View file

@ -9,10 +9,10 @@
<title xxtal:content="view/title">Document</title> <title xxtal:content="view/title">Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<xml xxtal:replace="structure view/mswordXml" /> <xml tal:replace="structure view/mswordXml" />
<style type="text/css" <style type="text/css"
xxtal:content="view/css"> tal:content="view/css">
</style> </style>
</head> </head>