Leser: 17
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
use OpenOffice::OODoc;
# Set variables
my $testfile = "test";
my $archive = odfContainer($testfile, create => 'text');
my $title = "OpenOffice::OODoc test document";
# Opening the content using OpenOffice::OODoc::Document
my $doc = odfConnector
(
container => $archive,
part => 'content',
readable_XML => 'true'
)
or die "# Unable to find a regular document content\n";
my $styles = odfConnector
(
container => $archive,
part => 'styles',
readable_XML => 'true'
)
or die "# Unable to get the styles\n";
### read input file and write to OO text document
$inputfile = @ARGV[0];
open (INP, $inputfile);
$c=0;
while (<INP>)
{
@line = split (/\t/, $_);
if ( @line[14]=~/[a-z]/ & $c!=0 )
{
@line[11]=~s/\n//g;
@line[12]=~s/\n//g;
@line[13]=~s/\n//g;
@line[14]=~s/\n//g;
# Appending a level 1 heading
$doc->appendHeading
(
text => "@line[11]\n",
level => "1",
style => "Heading_20_1"
);
# Appending a level 2 heading
$doc->appendHeading
(
text => "@line[12]\n",
level => "2",
style => "Heading_14_1"
);
# Appending a level 2 heading
$doc->appendHeading
(
text => "\n",
level => "2",
style => "Heading_14_1"
);
# Appending a level 3 heading
$doc->appendHeading
(
text => "@line[13]\n",
level => "3",
style => "Heading_10_1"
);
$doc->appendHeading
(
text => "\n",
level => "3",
style => "Heading_10_1"
);
$styles->createStyle
(
"Colour",
family => 'paragraph',
parent => 'Standard',
properties =>
{
-area => 'paragraph',
'fo:text-align' => 'justify'
}
);
if ($doc->isOpenDocument)
{
$styles->styleProperties
("Colour", -area => 'text');
}
my $pg = $doc->appendParagraph(text => "@line[14]\n", style => "Colour" );
print "@line[14]\n";
}
$c++;
### setPageBreak; aber wie?
}
# Saving the $testfile file
print "Saving $testfile file\n";
$archive->save;
1 2
my $pagebreaked_para = $doc->appendParagraph(); $doc->setPageBreak($pagebreaked_para);
[OpenOffice::OODoc::Document::setPageBreak] Element style not found
1
2
3
4
5
6
7
8
9
if ($doc->isOpenDocument)
{
$styles->styleProperties
("Colour", -area => 'text');
$styles->setPageBreak(position => 'after',style => "Colour");
}
my $pg = $doc->appendParagraph(text => "@line[14]\n", style => "Colour" );
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
$styles->createStyle
(
"Colour",
family => 'paragraph',
parent => 'Standard',
properties =>
{
-area => 'paragraph',
'fo:text-align' => 'justify'
}
);
if ($doc->isOpenDocument)
{
$styles->styleProperties
("Colour", -area => 'text');
}
my $pg = $doc->appendParagraph(text => "@line[14]", style => "Colour" );
$doc -> setPageBreak($pg , position => "after",style=>"Colour");