surpass 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/surpass/worksheet.rb +1 -1
- data/lib/surpass.rb +1 -1
- data/out.bin +0 -0
- metadata +3 -263
- data/examples/big-16mb.rb +0 -25
- data/examples/big-random-strings.rb +0 -28
- data/examples/blanks.rb +0 -34
- data/examples/blanks.xls +0 -0
- data/examples/col_width.rb +0 -16
- data/examples/col_width.xls +0 -0
- data/examples/dates.rb +0 -31
- data/examples/dates.xls +0 -0
- data/examples/format.rb +0 -23
- data/examples/format.xls +0 -0
- data/examples/hello-world.rb +0 -9
- data/examples/hello-world.xls +0 -0
- data/examples/image.rb +0 -10
- data/examples/image.xls +0 -0
- data/examples/merged.rb +0 -36
- data/examples/merged.xls +0 -0
- data/examples/merged0.rb +0 -27
- data/examples/merged0.xls +0 -0
- data/examples/merged1.rb +0 -99
- data/examples/merged1.xls +0 -0
- data/examples/num_formats.rb +0 -55
- data/examples/num_formats.xls +0 -0
- data/examples/numbers.rb +0 -24
- data/examples/numbers.xls +0 -0
- data/examples/outline.rb +0 -110
- data/examples/outline.xls +0 -0
- data/examples/panes.rb +0 -48
- data/examples/panes.xls +0 -0
- data/examples/protection.rb +0 -132
- data/examples/protection.xls +0 -0
- data/examples/python.bmp +0 -0
- data/examples/row_styles.rb +0 -16
- data/examples/row_styles.xls +0 -0
- data/examples/row_styles_empty.rb +0 -15
- data/examples/row_styles_empty.xls +0 -0
- data/examples/set_cell_and_range_style.rb +0 -12
- data/examples/set_cell_and_range_style.xls +0 -0
- data/examples/wrapped-text.rb +0 -13
- data/examples/wrapped-text.xls +0 -0
- data/examples/write_arrays.rb +0 -22
- data/examples/write_arrays.xls +0 -0
- data/examples/ws_props.rb +0 -80
- data/spec/biff_record_spec.rb +0 -268
- data/spec/cell_spec.rb +0 -56
- data/spec/data/random-strings.txt +0 -10000
- data/spec/document_spec.rb +0 -168
- data/spec/excel_formula_spec.rb +0 -27
- data/spec/formatting_spec.rb +0 -53
- data/spec/output/cells-rk.xls +0 -0
- data/spec/output/cells.xls +0 -0
- data/spec/output/mini.xls +0 -0
- data/spec/reference/P-0508-0000507647-3280-5298.xls +0 -0
- data/spec/reference/all-cell-styles.bin +0 -0
- data/spec/reference/all-number-formats.bin +0 -0
- data/spec/reference/all-styles.bin +0 -0
- data/spec/reference/mini.xls +0 -0
- data/spec/row_spec.rb +0 -19
- data/spec/spec_helper.rb +0 -10
- data/spec/style_spec.rb +0 -89
- data/spec/surpass_spec.rb +0 -7
- data/spec/utilities_spec.rb +0 -57
- data/spec/workbook_spec.rb +0 -48
- data/spec/worksheet_spec.rb +0 -0
- data/stats/cloc.txt +0 -8
- data/stats/rcov.txt +0 -0
- data/stats/specdoc.txt +0 -158
- data/webby/README.txt +0 -6
- data/webby/Sitefile +0 -43
- data/webby/content/css/pygments.txt +0 -6
- data/webby/content/css/style.css +0 -279
- data/webby/content/examples/autoformat.png +0 -0
- data/webby/content/examples/autoformat.rb +0 -32
- data/webby/content/examples/autoformat.xls +0 -0
- data/webby/content/examples/borders.png +0 -0
- data/webby/content/examples/borders.rb +0 -15
- data/webby/content/examples/borders.xls +0 -0
- data/webby/content/examples/colours.png +0 -0
- data/webby/content/examples/colours.rb +0 -23
- data/webby/content/examples/colours.xls +0 -0
- data/webby/content/examples/data.png +0 -0
- data/webby/content/examples/data.rb +0 -11
- data/webby/content/examples/data.xls +0 -0
- data/webby/content/examples/formatting.png +0 -0
- data/webby/content/examples/formatting.rb +0 -78
- data/webby/content/examples/formatting.xls +0 -0
- data/webby/content/examples/hello-world.png +0 -0
- data/webby/content/examples/hello-world.py +0 -8
- data/webby/content/examples/hello-world.rb +0 -9
- data/webby/content/examples/hello-world.xls +0 -0
- data/webby/content/examples/number-format-string.png +0 -0
- data/webby/content/examples/number-format-string.rb +0 -14
- data/webby/content/examples/number-format-string.xls +0 -0
- data/webby/content/examples/patterns.png +0 -0
- data/webby/content/examples/patterns.rb +0 -26
- data/webby/content/examples/patterns.xls +0 -0
- data/webby/content/examples/show-greens.sh +0 -1
- data/webby/content/examples/surpass-info.sh +0 -1
- data/webby/content/img/Thumbs.db +0 -0
- data/webby/content/img/bg_menu.gif +0 -0
- data/webby/content/img/bg_t.gif +0 -0
- data/webby/content/img/bullet.gif +0 -0
- data/webby/content/img/logo.png +0 -0
- data/webby/content/img/logo_.jpg +0 -0
- data/webby/content/img/top_bg.gif +0 -0
- data/webby/content/img/top_bg_.gif +0 -0
- data/webby/content/index.txt +0 -16
- data/webby/content/installation/index.txt +0 -24
- data/webby/content/source/ExcelFormulaLexer.txt +0 -7
- data/webby/content/source/ExcelFormulaParser.txt +0 -7
- data/webby/content/source/biff_record.txt +0 -7
- data/webby/content/source/bitmap.txt +0 -7
- data/webby/content/source/cell.txt +0 -7
- data/webby/content/source/chart.txt +0 -7
- data/webby/content/source/column.txt +0 -7
- data/webby/content/source/document.txt +0 -7
- data/webby/content/source/excel_formula.txt +0 -7
- data/webby/content/source/excel_magic.txt +0 -7
- data/webby/content/source/formatting.txt +0 -7
- data/webby/content/source/row.txt +0 -7
- data/webby/content/source/style.txt +0 -7
- data/webby/content/source/utilities.txt +0 -7
- data/webby/content/source/workbook.txt +0 -7
- data/webby/content/source/worksheet.txt +0 -7
- data/webby/content/surpass-manual.erb +0 -198
- data/webby/layouts/book.txt +0 -29
- data/webby/layouts/default.txt +0 -27
- data/webby/layouts/two_column.txt +0 -25
- data/webby/layouts/web.txt +0 -66
- data/webby/output/.cairn +0 -0
- data/webby/output/css/blueprint/ie.css +0 -26
- data/webby/output/css/blueprint/plugins/buttons/icons/cross.png +0 -0
- data/webby/output/css/blueprint/plugins/buttons/icons/key.png +0 -0
- data/webby/output/css/blueprint/plugins/buttons/icons/tick.png +0 -0
- data/webby/output/css/blueprint/plugins/buttons/readme.txt +0 -32
- data/webby/output/css/blueprint/plugins/buttons/screen.css +0 -97
- data/webby/output/css/blueprint/plugins/fancy-type/readme.txt +0 -14
- data/webby/output/css/blueprint/plugins/fancy-type/screen.css +0 -71
- data/webby/output/css/blueprint/plugins/link-icons/icons/doc.png +0 -0
- data/webby/output/css/blueprint/plugins/link-icons/icons/email.png +0 -0
- data/webby/output/css/blueprint/plugins/link-icons/icons/external.png +0 -0
- data/webby/output/css/blueprint/plugins/link-icons/icons/feed.png +0 -0
- data/webby/output/css/blueprint/plugins/link-icons/icons/im.png +0 -0
- data/webby/output/css/blueprint/plugins/link-icons/icons/pdf.png +0 -0
- data/webby/output/css/blueprint/plugins/link-icons/icons/visited.png +0 -0
- data/webby/output/css/blueprint/plugins/link-icons/icons/xls.png +0 -0
- data/webby/output/css/blueprint/plugins/link-icons/readme.txt +0 -18
- data/webby/output/css/blueprint/plugins/link-icons/screen.css +0 -40
- data/webby/output/css/blueprint/plugins/rtl/readme.txt +0 -10
- data/webby/output/css/blueprint/plugins/rtl/screen.css +0 -109
- data/webby/output/css/blueprint/print.css +0 -30
- data/webby/output/css/blueprint/screen.css +0 -251
- data/webby/output/css/blueprint/src/forms.css +0 -49
- data/webby/output/css/blueprint/src/grid.css +0 -212
- data/webby/output/css/blueprint/src/grid.png +0 -0
- data/webby/output/css/blueprint/src/ie.css +0 -59
- data/webby/output/css/blueprint/src/print.css +0 -85
- data/webby/output/css/blueprint/src/reset.css +0 -38
- data/webby/output/css/blueprint/src/typography.css +0 -105
- data/webby/output/css/pygments.css +0 -59
- data/webby/output/css/site.css +0 -62
- data/webby/output/css/style.css +0 -279
- data/webby/output/examples/autoformat.png +0 -0
- data/webby/output/examples/autoformat.rb +0 -32
- data/webby/output/examples/autoformat.xls +0 -0
- data/webby/output/examples/borders.png +0 -0
- data/webby/output/examples/borders.rb +0 -15
- data/webby/output/examples/borders.xls +0 -0
- data/webby/output/examples/colours.png +0 -0
- data/webby/output/examples/colours.rb +0 -23
- data/webby/output/examples/colours.xls +0 -0
- data/webby/output/examples/data.png +0 -0
- data/webby/output/examples/data.rb +0 -11
- data/webby/output/examples/data.xls +0 -0
- data/webby/output/examples/formatting.png +0 -0
- data/webby/output/examples/formatting.rb +0 -78
- data/webby/output/examples/formatting.xls +0 -0
- data/webby/output/examples/hello-world.png +0 -0
- data/webby/output/examples/hello-world.py +0 -8
- data/webby/output/examples/hello-world.rb +0 -9
- data/webby/output/examples/hello-world.xls +0 -0
- data/webby/output/examples/number-format-string.png +0 -0
- data/webby/output/examples/number-format-string.rb +0 -14
- data/webby/output/examples/number-format-string.xls +0 -0
- data/webby/output/examples/patterns.png +0 -0
- data/webby/output/examples/patterns.rb +0 -26
- data/webby/output/examples/patterns.xls +0 -0
- data/webby/output/examples/show-greens.sh +0 -1
- data/webby/output/examples/surpass-info.sh +0 -1
- data/webby/output/img/Thumbs.db +0 -0
- data/webby/output/img/bg_menu.gif +0 -0
- data/webby/output/img/bg_t.gif +0 -0
- data/webby/output/img/bullet.gif +0 -0
- data/webby/output/img/logo.png +0 -0
- data/webby/output/img/logo_.jpg +0 -0
- data/webby/output/img/top_bg.gif +0 -0
- data/webby/output/img/top_bg_.gif +0 -0
- data/webby/output/index.html +0 -138
- data/webby/output/installation/index.html +0 -64
- data/webby/output/installation/installation.html +0 -1
- data/webby/output/installation.html +0 -1
- data/webby/output/source/ExcelFormulaLexer.html +0 -981
- data/webby/output/source/ExcelFormulaParser.html +0 -661
- data/webby/output/source/biff_record.html +0 -462
- data/webby/output/source/bitmap.html +0 -277
- data/webby/output/source/cell.html +0 -241
- data/webby/output/source/chart.html +0 -64
- data/webby/output/source/column.html +0 -99
- data/webby/output/source/document.html +0 -465
- data/webby/output/source/excel_formula.html +0 -82
- data/webby/output/source/excel_magic.html +0 -1072
- data/webby/output/source/formatting.html +0 -664
- data/webby/output/source/row.html +0 -169
- data/webby/output/source/style.html +0 -158
- data/webby/output/source/surpass.html +0 -110
- data/webby/output/source/utilities.html +0 -145
- data/webby/output/source/workbook.html +0 -265
- data/webby/output/source/worksheet.html +0 -331
- data/webby/output/surpass-manual-0-0-5.pdf +0 -0
- data/webby/output/surpass-manual.aux +0 -50
- data/webby/output/surpass-manual.log +0 -366
- data/webby/output/surpass-manual.out +0 -20
- data/webby/output/surpass-manual.tex +0 -582
- data/webby/output/surpass-manual.toc +0 -20
- data/webby/rsync-exclude +0 -7
- data/webby/tasks/latex.rake +0 -14
- data/webby/tasks/screenshots.rb +0 -58
- data/webby/templates/article.erb +0 -15
- data/webby/templates/book.erb +0 -16
- data/webby/templates/page.erb +0 -9
@@ -1,582 +0,0 @@
|
|
1
|
-
\documentclass[a4paper]{book}
|
2
|
-
\usepackage{fullpage}
|
3
|
-
\usepackage{fancyvrb}
|
4
|
-
\usepackage{color}
|
5
|
-
\usepackage[ascii]{inputenc}
|
6
|
-
\usepackage{hyperref}
|
7
|
-
\usepackage[pdftex]{graphicx}
|
8
|
-
\usepackage{wrapfig}
|
9
|
-
\usepackage{multicol}
|
10
|
-
|
11
|
-
\newcommand\PYZat{@}
|
12
|
-
\newcommand\PYZlb{[}
|
13
|
-
\newcommand\PYZrb{]}
|
14
|
-
\newcommand\PYbh[1]{\textcolor[rgb]{0.00,0.50,0.00}{\textbf{#1}}}
|
15
|
-
\newcommand\PYbg[1]{\textcolor[rgb]{0.73,0.40,0.53}{\textbf{#1}}}
|
16
|
-
\newcommand\PYbf[1]{\textcolor[rgb]{0.82,0.25,0.23}{\textbf{#1}}}
|
17
|
-
\newcommand\PYbe[1]{\textcolor[rgb]{0.40,0.40,0.40}{#1}}
|
18
|
-
\newcommand\PYbd[1]{\textcolor[rgb]{0.73,0.13,0.13}{#1}}
|
19
|
-
\newcommand\PYbc[1]{\textcolor[rgb]{0.00,0.50,0.00}{\textbf{#1}}}
|
20
|
-
\newcommand\PYbb[1]{\textcolor[rgb]{0.00,0.50,0.00}{#1}}
|
21
|
-
\newcommand\PYba[1]{\textcolor[rgb]{0.00,0.00,0.50}{\textbf{#1}}}
|
22
|
-
\newcommand\PYaJ[1]{\textcolor[rgb]{0.69,0.00,0.25}{#1}}
|
23
|
-
\newcommand\PYaK[1]{\textcolor[rgb]{0.73,0.13,0.13}{#1}}
|
24
|
-
\newcommand\PYaH[1]{\textcolor[rgb]{0.50,0.00,0.50}{\textbf{#1}}}
|
25
|
-
\newcommand\PYaI[1]{\fcolorbox[rgb]{1.00,0.00,0.00}{1,1,1}{#1}}
|
26
|
-
\newcommand\PYaN[1]{\textcolor[rgb]{0.74,0.48,0.00}{#1}}
|
27
|
-
\newcommand\PYaO[1]{\textcolor[rgb]{0.00,0.00,1.00}{\textbf{#1}}}
|
28
|
-
\newcommand\PYaL[1]{\textcolor[rgb]{0.00,0.00,1.00}{#1}}
|
29
|
-
\newcommand\PYaM[1]{\textcolor[rgb]{0.73,0.73,0.73}{#1}}
|
30
|
-
\newcommand\PYaB[1]{\textcolor[rgb]{0.73,0.13,0.13}{#1}}
|
31
|
-
\newcommand\PYaC[1]{\textcolor[rgb]{0.67,0.13,1.00}{#1}}
|
32
|
-
\newcommand\PYaA[1]{\textcolor[rgb]{0.00,0.50,0.00}{#1}}
|
33
|
-
\newcommand\PYaF[1]{\textcolor[rgb]{0.63,0.00,0.00}{#1}}
|
34
|
-
\newcommand\PYaG[1]{\textcolor[rgb]{1.00,0.00,0.00}{#1}}
|
35
|
-
\newcommand\PYaD[1]{\textcolor[rgb]{0.00,0.50,0.00}{\textbf{#1}}}
|
36
|
-
\newcommand\PYaE[1]{\textcolor[rgb]{0.25,0.50,0.50}{\textit{#1}}}
|
37
|
-
\newcommand\PYaZ[1]{\textcolor[rgb]{0.00,0.50,0.00}{\textbf{#1}}}
|
38
|
-
\newcommand\PYaX[1]{\textcolor[rgb]{0.00,0.50,0.00}{#1}}
|
39
|
-
\newcommand\PYaY[1]{\textcolor[rgb]{0.73,0.13,0.13}{#1}}
|
40
|
-
\newcommand\PYaR[1]{\textcolor[rgb]{0.40,0.40,0.40}{#1}}
|
41
|
-
\newcommand\PYaS[1]{\textcolor[rgb]{0.10,0.09,0.49}{#1}}
|
42
|
-
\newcommand\PYaP[1]{\textcolor[rgb]{0.00,0.00,0.50}{\textbf{#1}}}
|
43
|
-
\newcommand\PYaQ[1]{\textcolor[rgb]{0.49,0.56,0.16}{#1}}
|
44
|
-
\newcommand\PYaV[1]{\textcolor[rgb]{0.00,0.00,1.00}{\textbf{#1}}}
|
45
|
-
\newcommand\PYaW[1]{\textcolor[rgb]{0.73,0.13,0.13}{#1}}
|
46
|
-
\newcommand\PYaT[1]{\textcolor[rgb]{0.40,0.40,0.40}{#1}}
|
47
|
-
\newcommand\PYaU[1]{\textcolor[rgb]{0.25,0.50,0.50}{\textit{#1}}}
|
48
|
-
\newcommand\PYaj[1]{\textcolor[rgb]{0.00,0.50,0.00}{#1}}
|
49
|
-
\newcommand\PYak[1]{\textcolor[rgb]{0.73,0.40,0.53}{#1}}
|
50
|
-
\newcommand\PYah[1]{\textcolor[rgb]{0.63,0.63,0.00}{#1}}
|
51
|
-
\newcommand\PYai[1]{\textcolor[rgb]{0.10,0.09,0.49}{#1}}
|
52
|
-
\newcommand\PYan[1]{\textcolor[rgb]{0.40,0.40,0.40}{#1}}
|
53
|
-
\newcommand\PYao[1]{\textcolor[rgb]{0.73,0.40,0.13}{\textbf{#1}}}
|
54
|
-
\newcommand\PYal[1]{\textcolor[rgb]{0.25,0.50,0.50}{\textit{#1}}}
|
55
|
-
\newcommand\PYam[1]{\textbf{#1}}
|
56
|
-
\newcommand\PYab[1]{\textit{#1}}
|
57
|
-
\newcommand\PYac[1]{\textcolor[rgb]{0.73,0.13,0.13}{#1}}
|
58
|
-
\newcommand\PYaa[1]{\textcolor[rgb]{0.50,0.50,0.50}{#1}}
|
59
|
-
\newcommand\PYaf[1]{\textcolor[rgb]{0.25,0.50,0.50}{\textit{#1}}}
|
60
|
-
\newcommand\PYag[1]{\textcolor[rgb]{0.40,0.40,0.40}{#1}}
|
61
|
-
\newcommand\PYad[1]{\textcolor[rgb]{0.00,0.25,0.82}{#1}}
|
62
|
-
\newcommand\PYae[1]{\textcolor[rgb]{0.40,0.40,0.40}{#1}}
|
63
|
-
\newcommand\PYaz[1]{\textcolor[rgb]{0.00,0.63,0.00}{#1}}
|
64
|
-
\newcommand\PYax[1]{\textcolor[rgb]{0.60,0.60,0.60}{\textbf{#1}}}
|
65
|
-
\newcommand\PYay[1]{\textcolor[rgb]{0.00,0.50,0.00}{\textbf{#1}}}
|
66
|
-
\newcommand\PYar[1]{\textcolor[rgb]{0.10,0.09,0.49}{#1}}
|
67
|
-
\newcommand\PYas[1]{\textcolor[rgb]{0.73,0.13,0.13}{\textit{#1}}}
|
68
|
-
\newcommand\PYap[1]{\textcolor[rgb]{0.00,0.50,0.00}{\textbf{#1}}}
|
69
|
-
\newcommand\PYaq[1]{\textcolor[rgb]{0.53,0.00,0.00}{#1}}
|
70
|
-
\newcommand\PYav[1]{\textcolor[rgb]{0.67,0.13,1.00}{\textbf{#1}}}
|
71
|
-
\newcommand\PYaw[1]{\textcolor[rgb]{0.40,0.40,0.40}{#1}}
|
72
|
-
\newcommand\PYat[1]{\textcolor[rgb]{0.10,0.09,0.49}{#1}}
|
73
|
-
\newcommand\PYau[1]{\textcolor[rgb]{0.10,0.09,0.49}{#1}}
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
\title{Surpass Manual}
|
78
|
-
\author{Ana Nelson}
|
79
|
-
|
80
|
-
\begin{document}
|
81
|
-
|
82
|
-
\maketitle
|
83
|
-
|
84
|
-
\tableofcontents
|
85
|
-
|
86
|
-
To compile this documentation requires \LaTeX and the gems Gorgyrella and Webby.
|
87
|
-
|
88
|
-
This documentation refers to Surpass version 0.0.5.
|
89
|
-
|
90
|
-
\chapter{Installation and Hello World} % (fold)
|
91
|
-
\label{cha:installation_and_hello_world}
|
92
|
-
|
93
|
-
\section{Dependencies} % (fold)
|
94
|
-
\label{sec:dependencies}
|
95
|
-
|
96
|
-
Surpass only needs basic Ruby. It has been tested using Ruby 1.8.6 and JRuby 1.1.5.
|
97
|
-
|
98
|
-
For development, you will want to have access to something that can open Microsoft Excel files. This could be Microsoft Excel, Open Office, Google Docs or even a gmail account.
|
99
|
-
|
100
|
-
% section dependencies (end)
|
101
|
-
|
102
|
-
\section{Gem Installation}
|
103
|
-
|
104
|
-
\begin{verbatim}
|
105
|
-
sudo gem install surpass
|
106
|
-
\end{verbatim}
|
107
|
-
|
108
|
-
\section{Source Installation}
|
109
|
-
|
110
|
-
\begin{verbatim}
|
111
|
-
bzr branch http://ananelson.com/code/surpass
|
112
|
-
cd surpass
|
113
|
-
sudo rake gem:install
|
114
|
-
\end{verbatim}
|
115
|
-
|
116
|
-
\section{Hello World}
|
117
|
-
|
118
|
-
Let's do a minimal "Hello World" script. We'll need to take care of any imports, initialize a Workbook object, create a Worksheet within the workbook, then write some text. Here's how.
|
119
|
-
|
120
|
-
\subsection{Surpass}
|
121
|
-
|
122
|
-
\begin{Verbatim}[commandchars=@\[\]]
|
123
|
-
@PYaX[require] @PYbd['rubygems']
|
124
|
-
@PYaX[require] @PYbd['surpass']
|
125
|
-
|
126
|
-
book @PYbe[=] @PYaq[Workbook]@PYbe[.]new
|
127
|
-
sheet @PYbe[=] book@PYbe[.]add_sheet
|
128
|
-
|
129
|
-
sheet@PYbe[.]write(@PYag[0], @PYag[0], @PYaW["]@PYaW[Hello World!]@PYaW["])
|
130
|
-
|
131
|
-
book@PYbe[.]save(@PYaW["]@PYaW[content/examples/hello-world.xls]@PYaW["])
|
132
|
-
\end{Verbatim}
|
133
|
-
|
134
|
-
|
135
|
-
\subsection{Result}
|
136
|
-
|
137
|
-
And, here's how it looks.
|
138
|
-
|
139
|
-
\includegraphics[width=15cm]{examples/hello-world.png}
|
140
|
-
|
141
|
-
% chapter installation_and_hello_world (end)
|
142
|
-
|
143
|
-
\chapter{Writing Data} % (fold)
|
144
|
-
\label{cha:writing_data}
|
145
|
-
|
146
|
-
\section{write} % (fold)
|
147
|
-
\label{sec:write}
|
148
|
-
|
149
|
-
The basic method for writing data to cells is the worksheet's write method.
|
150
|
-
|
151
|
-
\begin{Verbatim}[commandchars=@\[\]]
|
152
|
-
@PYay[def] @PYaL[write](r, c, label @PYbe[=] @PYaW["]@PYaW["], style @PYbe[=] @PYaj[nil])
|
153
|
-
row(r)@PYbe[.]write(c, label, style)
|
154
|
-
@PYay[end]
|
155
|
-
\end{Verbatim}
|
156
|
-
|
157
|
-
|
158
|
-
There are two required arguments, the row and column. These are zero-based indexes for the row and column. To write to the first cell in the spreadsheet, you would pass 0, 0. The next argument is the label, this is the value you want written in the cell. This defaults to an empty string (for no particular reason). You can write nil, a String, a Boolean, a Numeric or a Date format. If you pass an object belonging to an unsupported class, you will get an error message, and in this case you should call some method on your object which will return a String or whatever the appropriate label is. The fourth argument is for style, which should be either nil, true, a hash or an instance of the StyleFormat class. See the chapter on Formatting for more information. The style parameter defaults to nil, which means that the default Excel format will be applied.
|
159
|
-
|
160
|
-
\section{Writing Arrays of Data} % (fold)
|
161
|
-
\label{sec:writing_arrays_of_data}
|
162
|
-
|
163
|
-
Frequently, you may want to write more than one value at a time, and so Surpass has convenience methods which handle arrays for you. In the background, these are just looping over the array and calling write() for each value you pass. There's no magic here and, for now at least, no clever optimization. The available methods are write\_array\_to\_row, write\_array\_to\_column, and write\_arrays. The write\_arrays method expects an array of arrays, the first two expect a single array.
|
164
|
-
|
165
|
-
\begin{Verbatim}[commandchars=@\[\]]
|
166
|
-
@PYay[def] @PYaL[write_array_to_row](array, r, c @PYbe[=] @PYag[0], style @PYbe[=] @PYaj[true])
|
167
|
-
array@PYbe[.]each_with_index @PYay[do] @PYbe[|]a, i@PYbe[|]
|
168
|
-
row(r)@PYbe[.]write(c @PYbe[+] i, a, style)
|
169
|
-
@PYay[end]
|
170
|
-
@PYay[end]
|
171
|
-
|
172
|
-
@PYay[def] @PYaL[write_array_to_column](array, c, r @PYbe[=] @PYag[0], style @PYbe[=] @PYaj[true])
|
173
|
-
array@PYbe[.]each_with_index @PYay[do] @PYbe[|]a, i@PYbe[|]
|
174
|
-
row(r @PYbe[+] i)@PYbe[.]write(c, a, style)
|
175
|
-
@PYay[end]
|
176
|
-
@PYay[end]
|
177
|
-
|
178
|
-
@PYay[def] @PYaL[write_arrays](r, c, array_of_arrays, style @PYbe[=] @PYaj[true])
|
179
|
-
array_of_arrays@PYbe[.]each_with_index @PYay[do] @PYbe[|]a, i@PYbe[|]
|
180
|
-
@PYay[raise] @PYaW["]@PYaW[not an array of arrays!]@PYaW["] @PYay[unless] a@PYbe[.]is_a?(@PYaX[Array])
|
181
|
-
write_array_to_row(a, r @PYbe[+] i, c, style)
|
182
|
-
@PYay[end]
|
183
|
-
@PYay[end]
|
184
|
-
\end{Verbatim}
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
% section writing_arrays_of_data (end)
|
189
|
-
|
190
|
-
% section write (end)
|
191
|
-
|
192
|
-
\section{Autoformatting} % (fold)
|
193
|
-
\label{sec:autoformatting}
|
194
|
-
|
195
|
-
Autoformats are number formats which are automatically applied to Dates, Floats and similar classes. To have autoformats applied, then pass true as the style parameter to the write function.
|
196
|
-
|
197
|
-
Here is the relevant code from row.rb:
|
198
|
-
\begin{Verbatim}[commandchars=@\[\]]
|
199
|
-
@PYay[when] @PYaq[TrueClass] @PYaf[# Automatically apply a nice numeric format.]
|
200
|
-
@PYay[case] label
|
201
|
-
@PYay[when] @PYaq[DateTime], @PYaq[Time]
|
202
|
-
style @PYbe[=] @PYaS[@PYZat[]parent_wb]@PYbe[.]styles@PYbe[.]default_datetime_style
|
203
|
-
@PYay[when] @PYaq[Date]
|
204
|
-
style @PYbe[=] @PYaS[@PYZat[]parent_wb]@PYbe[.]styles@PYbe[.]default_date_style
|
205
|
-
@PYay[when] @PYaX[Float]
|
206
|
-
style @PYbe[=] @PYaS[@PYZat[]parent_wb]@PYbe[.]styles@PYbe[.]default_float_style
|
207
|
-
@PYay[else]
|
208
|
-
style @PYbe[=] @PYaS[@PYZat[]parent_wb]@PYbe[.]styles@PYbe[.]default_style
|
209
|
-
@PYay[end]
|
210
|
-
\end{Verbatim}
|
211
|
-
|
212
|
-
|
213
|
-
And here are the default formats being defined in style.rb:
|
214
|
-
\begin{Verbatim}[commandchars=@\[\]]
|
215
|
-
@PYay[def] @PYaL[default_date_style]
|
216
|
-
@PYaS[@PYZat[]default_date_style] @PYbe[||]@PYbe[=] @PYaq[StyleFormat]@PYbe[.]new(@PYau[:number_format_string] @PYbe[=]@PYbe[>] @PYbd['dd-mmm-yyyy'])
|
217
|
-
@PYay[end]
|
218
|
-
|
219
|
-
@PYay[def] @PYaL[default_datetime_style]
|
220
|
-
@PYaS[@PYZat[]default_datetime_style] @PYbe[||]@PYbe[=] @PYaq[StyleFormat]@PYbe[.]new(@PYau[:number_format_string] @PYbe[=]@PYbe[>] @PYbd['dd-mmm-yyyy hh:mm:ss'])
|
221
|
-
@PYay[end]
|
222
|
-
|
223
|
-
@PYay[def] @PYaL[default_float_style]
|
224
|
-
@PYaS[@PYZat[]default_float_style] @PYbe[||]@PYbe[=] @PYaq[StyleFormat]@PYbe[.]new(@PYau[:number_format_string] @PYbe[=]@PYbe[>] @PYbd['#,##0.00'])
|
225
|
-
@PYay[end]
|
226
|
-
\end{Verbatim}
|
227
|
-
|
228
|
-
|
229
|
-
If you use any of the array-writing methods, then autoformatting will be applied by default. To override this behaviour you can pass your own StyleFormat or nil to use the generic default format.
|
230
|
-
|
231
|
-
\begin{Verbatim}[commandchars=@\[\]]
|
232
|
-
@PYaX[require] @PYbd['rubygems']
|
233
|
-
@PYaX[require] @PYbd['surpass']
|
234
|
-
|
235
|
-
book @PYbe[=] @PYaq[Workbook]@PYbe[.]new(@PYaA[__FILE__]@PYbe[.]gsub(@PYak[/]@PYak[rb$]@PYak[/], @PYaW["]@PYaW[xls]@PYaW["]))
|
236
|
-
sheet @PYbe[=] book@PYbe[.]add_sheet
|
237
|
-
|
238
|
-
@PYaf[# Passing true for the style parameter to write will invoke autoformatting.]
|
239
|
-
sheet@PYbe[.]write(@PYag[0], @PYag[0], @PYaW["]@PYaW[Hello World!]@PYaW["], @PYaj[true])
|
240
|
-
sheet@PYbe[.]write(@PYag[1], @PYag[0], @PYag[1], @PYaj[true])
|
241
|
-
sheet@PYbe[.]write(@PYag[2], @PYag[0], @PYag[1]@PYbe[.]@PYag[0], @PYaj[true])
|
242
|
-
sheet@PYbe[.]write(@PYag[3], @PYag[0], @PYaq[Date]@PYbe[.]today, @PYaj[true])
|
243
|
-
sheet@PYbe[.]write(@PYag[4], @PYag[0], @PYaq[DateTime]@PYbe[.]now, @PYaj[true])
|
244
|
-
sheet@PYbe[.]write(@PYag[5], @PYag[0], @PYaq[Time]@PYbe[.]now, @PYaj[true])
|
245
|
-
|
246
|
-
array_of_arrays @PYbe[=] @PYbe[@PYZlb[]]
|
247
|
-
@PYbe[@PYZlb[]]@PYag[1], @PYag[2], @PYag[3]@PYbe[@PYZrb[]],
|
248
|
-
@PYbe[@PYZlb[]]@PYag[1]@PYbe[.]@PYag[0], @PYag[2]@PYbe[.]@PYag[0], @PYag[3]@PYbe[.]@PYag[0]@PYbe[@PYZrb[]],
|
249
|
-
@PYbe[@PYZlb[]]@PYaq[Date]@PYbe[.]today, @PYaq[DateTime]@PYbe[.]now@PYbe[@PYZrb[]],
|
250
|
-
@PYbb[%w{]@PYbb[a b c]@PYbb[}]
|
251
|
-
@PYbe[@PYZrb[]]
|
252
|
-
|
253
|
-
@PYaf[# Writing arrays will automatically autoformat.]
|
254
|
-
sheet@PYbe[.]write(@PYag[7], @PYag[0], @PYaW["]@PYaW[With autoformat:]@PYaW["])
|
255
|
-
sheet@PYbe[.]write_arrays(@PYag[8], @PYag[0], array_of_arrays)
|
256
|
-
|
257
|
-
@PYaf[# Unless you specify your own format, or nil for a generic default.]
|
258
|
-
sheet@PYbe[.]write(@PYag[13], @PYag[0], @PYaW["]@PYaW[Without autoformat:]@PYaW["])
|
259
|
-
sheet@PYbe[.]write_arrays(@PYag[14], @PYag[0], array_of_arrays, @PYaj[nil])
|
260
|
-
|
261
|
-
sheet@PYbe[.]set_column_widths(@PYag[0]@PYbe[.].@PYag[2], @PYag[20])
|
262
|
-
|
263
|
-
book@PYbe[.]save
|
264
|
-
\end{Verbatim}
|
265
|
-
|
266
|
-
|
267
|
-
\includegraphics[width=15cm]{examples/autoformat.png}
|
268
|
-
|
269
|
-
% section autoformatting (end)
|
270
|
-
|
271
|
-
% chapter writing_data (end)
|
272
|
-
|
273
|
-
|
274
|
-
\chapter{Formatting} % (fold)
|
275
|
-
\label{cha:formatting}
|
276
|
-
|
277
|
-
\section{Reference}
|
278
|
-
|
279
|
-
There is a command line tool included with Surpass which provides some useful reference data:
|
280
|
-
|
281
|
-
\begin{Verbatim}[commandchars=@\[\]]
|
282
|
-
surpass -h
|
283
|
-
\end{Verbatim}
|
284
|
-
|
285
|
-
\begin{verbatim}
|
286
|
-
Usage: surpass-info [options]
|
287
|
-
-c, --colors, --colours List available colors
|
288
|
-
-p, --patterns List available patterns
|
289
|
-
-h, --help Show this message
|
290
|
-
|
291
|
-
\end{verbatim}
|
292
|
-
|
293
|
-
And since you are running this on the command line, you can save or pipe the output to other commands:
|
294
|
-
|
295
|
-
\begin{Verbatim}[commandchars=@\[\]]
|
296
|
-
surpass -c | grep green
|
297
|
-
\end{Verbatim}
|
298
|
-
|
299
|
-
\begin{verbatim}
|
300
|
-
bright-green
|
301
|
-
dark-green
|
302
|
-
green
|
303
|
-
light-green
|
304
|
-
olive-green
|
305
|
-
sea-green
|
306
|
-
|
307
|
-
\end{verbatim}
|
308
|
-
|
309
|
-
\section{StyleFormat Class}
|
310
|
-
|
311
|
-
The StyleFormat class is a wrapper for the various types of formatting you can apply to a cell. StyleFormat has attributes:
|
312
|
-
|
313
|
-
\begin{itemize}
|
314
|
-
\item number\_format\_string
|
315
|
-
\item font
|
316
|
-
\item alignment
|
317
|
-
\item borders
|
318
|
-
\item pattern
|
319
|
-
\item protection
|
320
|
-
\end{itemize}
|
321
|
-
|
322
|
-
Each of these attributes (except for number\_format\_string) has a corresponding class, and you can look in lib/formatting.rb for the source.
|
323
|
-
|
324
|
-
There are two basic ways to set formatting options. You can pass a hash with formatting options when you initialize a new StyleFormat instance, or you can set individual attributes of the formatting classes. You can also combine both approaches, initializing with a hash and then modifying attributes.
|
325
|
-
|
326
|
-
\section{Number Format Strings} % (fold)
|
327
|
-
\label{sec:number_format_strings}
|
328
|
-
|
329
|
-
This attribute is a simple string, specifying the numeric/date format to be applied to the value stored in a cell.
|
330
|
-
|
331
|
-
\newpage
|
332
|
-
|
333
|
-
\begin{Verbatim}[commandchars=@\[\]]
|
334
|
-
@PYaX[require] @PYbd['rubygems']
|
335
|
-
@PYaX[require] @PYbd['surpass']
|
336
|
-
|
337
|
-
book @PYbe[=] @PYaq[Workbook]@PYbe[.]new(@PYaA[__FILE__]@PYbe[.]gsub(@PYak[/]@PYak[rb$]@PYak[/], @PYaW["]@PYaW[xls]@PYaW["]))
|
338
|
-
sheet @PYbe[=] book@PYbe[.]add_sheet
|
339
|
-
|
340
|
-
date_format @PYbe[=] @PYaq[StyleFormat]@PYbe[.]new(@PYau[:number_format_string] @PYbe[=]@PYbe[>] @PYbd['DDD MMM YYYY'])
|
341
|
-
sheet@PYbe[.]write(@PYag[0], @PYag[0], @PYaq[Date]@PYbe[.]today, date_format)
|
342
|
-
|
343
|
-
two_dp_format @PYbe[=] @PYaq[StyleFormat]@PYbe[.]new
|
344
|
-
two_dp_format@PYbe[.]number_format_string @PYbe[=] @PYaW["]@PYaW[#]@PYaW[,]@PYaW[#]@PYaW[#]@PYaW[0.00]@PYaW["]
|
345
|
-
sheet@PYbe[.]write(@PYag[0], @PYag[1], @PYag[1002]@PYbe[.]@PYag[71828], two_dp_format)
|
346
|
-
|
347
|
-
book@PYbe[.]save
|
348
|
-
\end{Verbatim}
|
349
|
-
|
350
|
-
\includegraphics[width=16cm]{examples/number-format-string.png}
|
351
|
-
|
352
|
-
% section number_format_strings (end)
|
353
|
-
|
354
|
-
|
355
|
-
\subsection{Specifying Colours}
|
356
|
-
|
357
|
-
Here is a list of available colours:
|
358
|
-
|
359
|
-
\begin{multicols}{3}
|
360
|
-
\begin{verbatim}
|
361
|
-
aqua
|
362
|
-
black
|
363
|
-
blue
|
364
|
-
blue-grey
|
365
|
-
bright-green
|
366
|
-
brown
|
367
|
-
coral
|
368
|
-
cornflower-blue
|
369
|
-
dark-blue
|
370
|
-
dark-green
|
371
|
-
dark-red
|
372
|
-
dark-teal
|
373
|
-
dark-yellow
|
374
|
-
fuchsia
|
375
|
-
gold
|
376
|
-
gray
|
377
|
-
green
|
378
|
-
grey
|
379
|
-
grey-25-percent
|
380
|
-
grey-40-percent
|
381
|
-
grey-50-percent
|
382
|
-
grey-80-percent
|
383
|
-
indigo
|
384
|
-
lavender
|
385
|
-
lemon-chiffon
|
386
|
-
light-blue
|
387
|
-
light-cornflower-blue
|
388
|
-
light-green
|
389
|
-
light-orange
|
390
|
-
light-turquoise
|
391
|
-
light-yellow
|
392
|
-
lime
|
393
|
-
magenta
|
394
|
-
maroon
|
395
|
-
olive-green
|
396
|
-
orange
|
397
|
-
orchid
|
398
|
-
pale-blue
|
399
|
-
pink
|
400
|
-
plum
|
401
|
-
purple
|
402
|
-
red
|
403
|
-
rose
|
404
|
-
royal-blue
|
405
|
-
sea-green
|
406
|
-
silver
|
407
|
-
sky-blue
|
408
|
-
tan
|
409
|
-
teal
|
410
|
-
turquoise
|
411
|
-
violet
|
412
|
-
white
|
413
|
-
yellow
|
414
|
-
\end{verbatim}
|
415
|
-
\end{multicols}
|
416
|
-
|
417
|
-
\includegraphics[width=16cm]{examples/colours.png}
|
418
|
-
|
419
|
-
\subsection{Border Formats}
|
420
|
-
|
421
|
-
Here is a list of available border line types:
|
422
|
-
\begin{verbatim}
|
423
|
-
none
|
424
|
-
thin
|
425
|
-
medium
|
426
|
-
dashed
|
427
|
-
dotted
|
428
|
-
thick
|
429
|
-
double
|
430
|
-
hair
|
431
|
-
medium-dashed
|
432
|
-
thin-dash-dotted
|
433
|
-
medium-dash-dotted
|
434
|
-
thin-dash-dot-dotted
|
435
|
-
medium-dash-dot-dotted
|
436
|
-
slanted-medium-dash-dotted
|
437
|
-
\end{verbatim}
|
438
|
-
\includegraphics[width=16cm]{examples/borders.png}
|
439
|
-
|
440
|
-
\subsection{Fill Patterns}
|
441
|
-
|
442
|
-
Here is a list of available fill patterns:
|
443
|
-
\begin{verbatim}
|
444
|
-
none
|
445
|
-
solid
|
446
|
-
fine-dots
|
447
|
-
alt-bars
|
448
|
-
sparse-dots
|
449
|
-
thick-horz-bands
|
450
|
-
thick-vert-bands
|
451
|
-
thick-backward-diag
|
452
|
-
thick-forward-diag
|
453
|
-
big-spots
|
454
|
-
bricks
|
455
|
-
thin-horz-bands
|
456
|
-
thin-vert-bands
|
457
|
-
thin-backward-diag
|
458
|
-
thin-forward-diag
|
459
|
-
squares
|
460
|
-
diamonds
|
461
|
-
less-dots
|
462
|
-
least-dots
|
463
|
-
\end{verbatim}
|
464
|
-
\includegraphics[width=16cm]{examples/patterns.png}
|
465
|
-
|
466
|
-
\subsection{Surpass}
|
467
|
-
\begin{Verbatim}[commandchars=@\[\]]
|
468
|
-
@PYaX[require] @PYbd['rubygems']
|
469
|
-
@PYaX[require] @PYbd['surpass']
|
470
|
-
|
471
|
-
book @PYbe[=] @PYaq[Workbook]@PYbe[.]new(@PYaA[__FILE__]@PYbe[.]gsub(@PYak[/]@PYak[rb$]@PYak[/], @PYaW["]@PYaW[xls]@PYaW["]))
|
472
|
-
sheet @PYbe[=] book@PYbe[.]add_sheet(@PYaW["]@PYaW[Demo Worksheet]@PYaW["]) @PYaf[# You can name your worksheets.]
|
473
|
-
|
474
|
-
@PYaf[# Let's set up some formatting.]
|
475
|
-
|
476
|
-
@PYaf[# Remember to use Excel-style formatting directives, not sprintf.]
|
477
|
-
date_format @PYbe[=] @PYaq[StyleFormat]@PYbe[.]new(@PYau[:number_format_string] @PYbe[=]@PYbe[>] @PYaW["]@PYaW[DDDD DD MMM YYYY]@PYaW["])
|
478
|
-
|
479
|
-
fancy_format @PYbe[=] @PYaq[StyleFormat]@PYbe[.]new(
|
480
|
-
@PYau[:font_name] @PYbe[=]@PYbe[>] @PYbd['Times New Roman'],
|
481
|
-
@PYau[:font_colour] @PYbe[=]@PYbe[>] @PYbd['green'],
|
482
|
-
@PYau[:font_italic] @PYbe[=]@PYbe[>] @PYaj[true]
|
483
|
-
)
|
484
|
-
|
485
|
-
sheet@PYbe[.]write(@PYag[0], @PYag[0], @PYaW["]@PYaW[Hello World!]@PYaW["], fancy_format)
|
486
|
-
sheet@PYbe[.]write(@PYag[0], @PYag[1], @PYaq[Date]@PYbe[.]today, date_format)
|
487
|
-
|
488
|
-
@PYaf[# You can also set up formatting by passing attributes directly to the constituents of StyleFormat]
|
489
|
-
|
490
|
-
@PYaf[# Font colours.]
|
491
|
-
@PYaq[Formatting]@PYbe[::]@PYaq[COLOURS]@PYbe[.]keys@PYbe[.]each_with_index @PYay[do] @PYbe[|]c, i@PYbe[|]
|
492
|
-
@PYaX[format] @PYbe[=] @PYaq[StyleFormat]@PYbe[.]new
|
493
|
-
@PYaX[format]@PYbe[.]font@PYbe[.]name @PYbe[=] @PYbd['Verdana']
|
494
|
-
@PYaX[format]@PYbe[.]font@PYbe[.]color @PYbe[=] c
|
495
|
-
@PYaX[format]@PYbe[.]font@PYbe[.]size @PYbe[=] i @PYbe[+] @PYag[5]
|
496
|
-
sheet@PYbe[.]write(i, @PYag[5], c, @PYaX[format])
|
497
|
-
@PYay[end]
|
498
|
-
|
499
|
-
@PYaf[# Font underlining.]
|
500
|
-
|
501
|
-
@PYbe[@PYZlb[]]@PYau[:none], @PYau[:single], @PYau[:single_accounting], @PYau[:double], @PYau[:double_accounting], @PYaj[nil], @PYaj[true], @PYaj[false]@PYbe[@PYZrb[]]@PYbe[.]each_with_index @PYay[do] @PYbe[|]u, i@PYbe[|]
|
502
|
-
@PYaX[format] @PYbe[=] @PYaq[StyleFormat]@PYbe[.]new
|
503
|
-
@PYaX[format]@PYbe[.]font@PYbe[.]underline @PYbe[=] u
|
504
|
-
sheet@PYbe[.]write(i, @PYag[7], u@PYbe[.]to_s, @PYaX[format])
|
505
|
-
@PYay[end]
|
506
|
-
|
507
|
-
@PYaf[# Font bold, italic, strikethrough, outline are simple booleans.]
|
508
|
-
@PYbe[@PYZlb[]]@PYau[:bold], @PYau[:italic], @PYau[:struck_out], @PYau[:outline]@PYbe[@PYZrb[]]@PYbe[.]each_with_index @PYay[do] @PYbe[|]s, i@PYbe[|]
|
509
|
-
attribute @PYbe[=] (@PYaW["]@PYaW[font_]@PYaW["] @PYbe[+] s@PYbe[.]to_s)@PYbe[.]to_sym
|
510
|
-
sheet@PYbe[.]write(i, @PYag[8], s@PYbe[.]to_s, @PYaq[StyleFormat]@PYbe[.]new(attribute @PYbe[=]@PYbe[>] @PYaj[true]))
|
511
|
-
@PYay[end]
|
512
|
-
|
513
|
-
@PYaf[# Cell alignment.]
|
514
|
-
sheet@PYbe[.]write(@PYag[15], @PYag[2], @PYaW["]@PYaW[top left]@PYaW["], @PYau[:text_align] @PYbe[=]@PYbe[>] @PYbd['top left'],
|
515
|
-
@PYau[:border_top] @PYbe[=]@PYbe[>] @PYbd['pink'],
|
516
|
-
@PYau[:border_left] @PYbe[=]@PYbe[>] @PYbd['pink']
|
517
|
-
)
|
518
|
-
sheet@PYbe[.]write(@PYag[15], @PYag[3], @PYaW["]@PYaW[top center]@PYaW["], @PYau[:text_align] @PYbe[=]@PYbe[>] @PYbd['top center'])
|
519
|
-
sheet@PYbe[.]write(@PYag[15], @PYag[4], @PYaW["]@PYaW[top right]@PYaW["], @PYau[:text_align] @PYbe[=]@PYbe[>] @PYbd['top right'])
|
520
|
-
sheet@PYbe[.]write(@PYag[16], @PYag[2], @PYaW["]@PYaW[bottom left]@PYaW["], @PYau[:text_align] @PYbe[=]@PYbe[>] @PYbd['bottom left'])
|
521
|
-
sheet@PYbe[.]write(@PYag[16], @PYag[3], @PYaW["]@PYaW[bottom centre]@PYaW["], @PYau[:text_align] @PYbe[=]@PYbe[>] @PYbd['bottom centre'])
|
522
|
-
sheet@PYbe[.]write(@PYag[16], @PYag[4], @PYaW["]@PYaW[bottom right]@PYaW["], @PYau[:text_align] @PYbe[=]@PYbe[>] @PYbd['bottom right'],
|
523
|
-
@PYau[:border_bottom] @PYbe[=]@PYbe[>] @PYbd['pink'],
|
524
|
-
@PYau[:border_right] @PYbe[=]@PYbe[>] @PYbd['pink']
|
525
|
-
)
|
526
|
-
|
527
|
-
|
528
|
-
@PYaf[# Borders]
|
529
|
-
sheet@PYbe[.]write(@PYag[3], @PYag[1], @PYaW["]@PYaW[borders]@PYaW["],
|
530
|
-
@PYau[:border_right] @PYbe[=]@PYbe[>] @PYbd['medium blue'],
|
531
|
-
@PYau[:border_left] @PYbe[=]@PYbe[>] @PYbd['yellow'], @PYaf[# thin by default]
|
532
|
-
@PYau[:border_top] @PYbe[=]@PYbe[>] @PYbd['dotted purple'],
|
533
|
-
@PYau[:border_bottom] @PYbe[=]@PYbe[>] @PYbd['dashed'] @PYaf[# black by default]
|
534
|
-
)
|
535
|
-
|
536
|
-
@PYaf[# Or the hash-free option.]
|
537
|
-
crazy_border_format @PYbe[=] @PYaq[StyleFormat]@PYbe[.]new
|
538
|
-
crazy_border_format@PYbe[.]borders@PYbe[.]all @PYbe[=] @PYbd['slanted-medium-dash-dotted grey']
|
539
|
-
crazy_border_format@PYbe[.]pattern@PYbe[.]fill @PYbe[=] @PYbd['light-cornflower-blue']
|
540
|
-
|
541
|
-
sheet@PYbe[.]write(@PYag[5], @PYag[1], @PYaW["]@PYaW[borders]@PYaW["], crazy_border_format)
|
542
|
-
|
543
|
-
sheet@PYbe[.]write(@PYag[7], @PYag[1], @PYaW["]@PYaW[fill]@PYaW["], @PYau[:fill_color] @PYbe[=]@PYbe[>] @PYbd['yellow'])
|
544
|
-
|
545
|
-
book@PYbe[.]save
|
546
|
-
\end{Verbatim}
|
547
|
-
|
548
|
-
|
549
|
-
And, here's how it looks.
|
550
|
-
|
551
|
-
\includegraphics[width=16cm]{examples/formatting.png}
|
552
|
-
|
553
|
-
% chapter formatting (end)
|
554
|
-
|
555
|
-
\chapter{Saving} % (fold)
|
556
|
-
\label{cha:saving}
|
557
|
-
|
558
|
-
Typically, you will call the workbook's save() method to write that workbook to a file. You can pass the filename as an argument to save(), or as an argument to new() when you first instantiate a workbook object.
|
559
|
-
|
560
|
-
However, you can also call a workbook's data() method, which gives you direct access to a workbook's binary data. You can write this to a file manually, as in this example:
|
561
|
-
|
562
|
-
\begin{Verbatim}[commandchars=@\[\]]
|
563
|
-
@PYaX[require] @PYbd['rubygems']
|
564
|
-
@PYaX[require] @PYbd['surpass']
|
565
|
-
|
566
|
-
book @PYbe[=] @PYaq[Workbook]@PYbe[.]new
|
567
|
-
sheet @PYbe[=] book@PYbe[.]add_sheet
|
568
|
-
|
569
|
-
sheet@PYbe[.]write(@PYag[0], @PYag[0], @PYaW["]@PYaW[Hello World!]@PYaW["])
|
570
|
-
|
571
|
-
@PYaq[File]@PYbe[.]open(@PYaA[__FILE__]@PYbe[.]gsub(@PYak[/]@PYak[rb$]@PYak[/], @PYaW["]@PYaW[xls]@PYaW["]), @PYaW["]@PYaW[w]@PYaW["]) @PYay[do] @PYbe[|]f@PYbe[|]
|
572
|
-
f@PYbe[.]write book@PYbe[.]data
|
573
|
-
@PYay[end]
|
574
|
-
\end{Verbatim}
|
575
|
-
|
576
|
-
|
577
|
-
Or, you could use this data as an argument to Rails' send\_data method.
|
578
|
-
|
579
|
-
% chapter saving (end)
|
580
|
-
|
581
|
-
|
582
|
-
\end{document}
|
@@ -1,20 +0,0 @@
|
|
1
|
-
\contentsline {chapter}{\numberline {1}Installation and Hello World}{5}{chapter.1}
|
2
|
-
\contentsline {section}{\numberline {1.1}Dependencies}{5}{section.1.1}
|
3
|
-
\contentsline {section}{\numberline {1.2}Gem Installation}{5}{section.1.2}
|
4
|
-
\contentsline {section}{\numberline {1.3}Source Installation}{5}{section.1.3}
|
5
|
-
\contentsline {section}{\numberline {1.4}Hello World}{5}{section.1.4}
|
6
|
-
\contentsline {subsection}{\numberline {1.4.1}Surpass}{5}{subsection.1.4.1}
|
7
|
-
\contentsline {subsection}{\numberline {1.4.2}Result}{5}{subsection.1.4.2}
|
8
|
-
\contentsline {chapter}{\numberline {2}Writing Data}{7}{chapter.2}
|
9
|
-
\contentsline {section}{\numberline {2.1}write}{7}{section.2.1}
|
10
|
-
\contentsline {section}{\numberline {2.2}Writing Arrays of Data}{7}{section.2.2}
|
11
|
-
\contentsline {section}{\numberline {2.3}Autoformatting}{8}{section.2.3}
|
12
|
-
\contentsline {chapter}{\numberline {3}Formatting}{11}{chapter.3}
|
13
|
-
\contentsline {section}{\numberline {3.1}Reference}{11}{section.3.1}
|
14
|
-
\contentsline {section}{\numberline {3.2}StyleFormat Class}{11}{section.3.2}
|
15
|
-
\contentsline {section}{\numberline {3.3}Number Format Strings}{12}{section.3.3}
|
16
|
-
\contentsline {subsection}{\numberline {3.3.1}Specifying Colours}{13}{subsection.3.3.1}
|
17
|
-
\contentsline {subsection}{\numberline {3.3.2}Border Formats}{14}{subsection.3.3.2}
|
18
|
-
\contentsline {subsection}{\numberline {3.3.3}Fill Patterns}{15}{subsection.3.3.3}
|
19
|
-
\contentsline {subsection}{\numberline {3.3.4}Surpass}{16}{subsection.3.3.4}
|
20
|
-
\contentsline {chapter}{\numberline {4}Saving}{19}{chapter.4}
|
data/webby/rsync-exclude
DELETED
data/webby/tasks/latex.rake
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
desc "render output latex to a PDF"
|
2
|
-
task :pdf => [:build] do
|
3
|
-
files = IO.popen("find output/").read
|
4
|
-
files.chomp.each do |f|
|
5
|
-
f = f.rstrip
|
6
|
-
next unless f =~ /\.tex$/
|
7
|
-
dir = File.dirname(f)
|
8
|
-
file = File.basename(f)
|
9
|
-
system("cd #{dir}; pdflatex #{file}")
|
10
|
-
|
11
|
-
`mv output/surpass-manual.pdf output/#{manual_filename}`
|
12
|
-
`cp output/#{manual_filename} ../..`
|
13
|
-
end
|
14
|
-
end
|
data/webby/tasks/screenshots.rb
DELETED
@@ -1,58 +0,0 @@
|
|
1
|
-
require "rubygems"
|
2
|
-
begin
|
3
|
-
require "rbosa"
|
4
|
-
rescue
|
5
|
-
"You don't have RubyOSA. That's okay but won't be able to automatically activate Excel for screenshots."
|
6
|
-
end
|
7
|
-
|
8
|
-
def capture_xls(xls, png)
|
9
|
-
`open #{xls}`
|
10
|
-
sleep 2
|
11
|
-
`screencapture #{png}`
|
12
|
-
`mogrify -crop 840x570+14+54 #{png}`
|
13
|
-
end
|
14
|
-
|
15
|
-
# Excel should be already open, and it should be assigned to a
|
16
|
-
# Space with nothing else in it for nice, tidy screenshots.
|
17
|
-
# Desktop background should be set to plain white, or use Backdrop.app.
|
18
|
-
# Also you should have "When switching to an application, switch to a ..." box checked
|
19
|
-
begin
|
20
|
-
app = OSA.app("Microsoft Excel")
|
21
|
-
app.activate
|
22
|
-
rescue
|
23
|
-
puts "OSA activation of Microsoft Excel didn't work, you'll have to activate it manually."
|
24
|
-
end
|
25
|
-
|
26
|
-
`mkdir -p output/examples`
|
27
|
-
|
28
|
-
# Take screenshots of all Ruby Examples.
|
29
|
-
`ls content/examples/*.rb`.chomp.split("\n").each_with_index do |f, i|
|
30
|
-
puts "processing #{f}..."
|
31
|
-
|
32
|
-
png = f.gsub(/rb$/, "png")
|
33
|
-
xls = f.gsub(/rb$/, "xls")
|
34
|
-
|
35
|
-
`ruby #{f}`
|
36
|
-
capture_xls(xls, png)
|
37
|
-
end
|
38
|
-
|
39
|
-
# Take screenshots of all Python Examples.
|
40
|
-
`ls content/examples/*.py`.chomp.split("\n").each_with_index do |f, i|
|
41
|
-
exit # Skip processing Python examples for the moment.
|
42
|
-
|
43
|
-
puts "processing #{f}..."
|
44
|
-
|
45
|
-
png = f.gsub(/\.py$/, "-python.png")
|
46
|
-
xls = f.gsub(/\.py$/, "-python.xls")
|
47
|
-
|
48
|
-
`python #{f}`
|
49
|
-
capture_xls(xls, png)
|
50
|
-
end
|
51
|
-
|
52
|
-
# Return to iTerm
|
53
|
-
begin
|
54
|
-
app = OSA.app("iTerm")
|
55
|
-
app.activate
|
56
|
-
rescue
|
57
|
-
end
|
58
|
-
|
data/webby/templates/article.erb
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
---
|
2
|
-
title: <%= title %>
|
3
|
-
author:
|
4
|
-
created_at: <%= Time.now.to_y %>
|
5
|
-
filter:
|
6
|
-
- erb
|
7
|
-
- idio
|
8
|
-
---
|
9
|
-
|
10
|
-
\section{section name} % (fold)
|
11
|
-
\label{sec:section_name}
|
12
|
-
|
13
|
-
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|
14
|
-
|
15
|
-
% section section_name (end)
|