Вы находитесь на странице: 1из 55

CREATE OR REPLACE package as_xlsx

is
/**********************************************
**
** Author: Anton Scheffer
** ate: !"#$%#%$!!
** &e'site: http://technolog()a*is)nl/'log
** See also: http://technolog()a*is)nl/'log/+p,!$""-
**
** Changelog:
** ate: %!#$%#%$!!
** A..e. Alig*ent/ hori0ontal/ 1ertical/ 2rapText
** ate: $3#$4#%$!!
** A..e. Co**ents/ 5ergeCells/ fixe. 'ug for .epen.enc( on 6LS#settings
** ate: !3#$4#%$!!
** A..e. 'ol. an. italic fonts
** ate: %%#$4#%$!!
** 7ixe. issue 2ith ti*e0one8s set to a region9na*e: instea. of a offset
** ate: $;#$<#%$!!
** 7ixe. issue 2ith =5L#escaping fro* text
** ate: %>#$-#%$!!
** A..e. 5?T#license
** ate: !!#$;#%$!!
** 7ixe. 6LS#issue 2ith colu*n 2i.th
** ate: %"#$"#%$!!
** A..e. font color
** ate: !3#!$#%$!!
** fixe. 'ug in a.._string
** ate: %3#$<#%$!%
** 7ixe. set_autofilter 9onl( one autofilter per sheet/ a..e. _xln*)_7ilterata'ase:
** A..e. list_1ali.ation , .rop#.o2n
**
************************************************************************
******
************************************************************************
******
Cop(right 9C: %$!!/ %$!% '( Anton Scheffer
Per*ission is here'( grante./ free of charge/ to an( person o'taining a cop(
of this soft2are an. associate. .ocu*entation files 9the @Soft2are@:/ to .eal
in the Soft2are 2ithout restriction/ inclu.ing 2ithout li*itation the rights
to use/ cop(/ *o.if(/ *erge/ pu'lish/ .istri'ute/ su'license/ an./or sell
copies of the Soft2are/ an. to per*it persons to 2ho* the Soft2are is
furnishe. to .o so/ su'Aect to the follo2ing con.itions:
The a'o1e cop(right notice an. this per*ission notice shall 'e inclu.e. in
all copies or su'stantial portions of the Soft2are)
TBE SO7T&ARE ?S PROC?E @AS ?S@/ &?TBODT &ARRA6TE O7 A6E F?6/
E=PRESS OR
?5PL?E/ ?6CLD?6G HDT 6OT L?5?TE TO TBE &ARRA6T?ES O7
5ERCBA6TAH?L?TE/
7?T6ESS 7OR A PART?CDLAR PDRPOSE A6 6O6?67R?6GE5E6T) ?6 6O
ECE6T SBALL TBE
ADTBORS OR COPER?GBT BOLERS HE L?AHLE 7OR A6E CLA?5/ A5AGES
OR OTBER
L?AH?L?TE/ &BETBER ?6 A6 ACT?O6 O7 CO6TRACT/ TORT OR OTBER&?SE/
AR?S?6G 7RO5/
ODT O7 OR ?6 CO66ECT?O6 &?TB TBE SO7T&ARE OR TBE DSE OR OTBER
EAL?6GS ?6
TBE SO7T&ARE)
************************************************************************
******
******************************************** */
##
t(pe tp_align*ent is recor.
9 1ertical 1archar%9!!:
/ hori0ontal 1archar%9!3:
/ 2rapText 'oolean
:I
##
proce.ure clear_2ork'ookI
##
proce.ure ne2_sheet9 p_sheetna*e 1archar% :, null :I
##
function Ora7*t%Excel9 p_for*at 1archar% :, null :
return 1archar%I
##
function get_nu*7*t9 p_for*at 1archar% :, null :
return pls_integerI
##
function get_font
9 p_na*e 1archar%
/ p_fa*il( pls_integer :, %
/ p_fontsi0e nu*'er :, !!
/ p_the*e pls_integer :, !
/ p_un.erline 'oolean :, false
/ p_italic 'oolean :, false
/ p_'ol. 'oolean :, false
/ p_rg' 1archar% :, null ## this is a hex ALPBA Re. Green Hlue 1alue
:
return pls_integerI
##
function get_fill
9 p_patternT(pe 1archar%
/ p_fgRGH 1archar% :, null ## this is a hex ALPBA Re. Green Hlue 1alue
:
return pls_integerI
##
function get_'or.er
9 p_top 1archar% :, 8thin8
/ p_'otto* 1archar% :, 8thin8
/ p_left 1archar% :, 8thin8
/ p_right 1archar% :, 8thin8
:
/*
none
thin
*e.iu*
.ashe.
.otte.
thick
.ou'le
hair
*e.iu*ashe.
.ashot
*e.iu*ashot
.ashotot
*e.iu*ashotot
slantashot
*/
return pls_integerI
##
function get_align*ent
9 p_1ertical 1archar% :, null
/ p_hori0ontal 1archar% :, null
/ p_2rapText 'oolean :, null
:
/* hori0ontal
center
centerContinuous
.istri'ute.
fill
general
Austif(
left
right
*/
/* 1ertical
'otto*
center
.istri'ute.
Austif(
top
*/
return tp_align*entI
##
proce.ure cell
9 p_col pls_integer
/ p_ro2 pls_integer
/ p_1alue nu*'er
/ p_nu*7*t?. pls_integer :, null
/ p_font?. pls_integer :, null
/ p_fill?. pls_integer :, null
/ p_'or.er?. pls_integer :, null
/ p_align*ent tp_align*ent :, null
/ p_sheet pls_integer :, null
:I
##
proce.ure cell
9 p_col pls_integer
/ p_ro2 pls_integer
/ p_1alue 1archar%
/ p_nu*7*t?. pls_integer :, null
/ p_font?. pls_integer :, null
/ p_fill?. pls_integer :, null
/ p_'or.er?. pls_integer :, null
/ p_align*ent tp_align*ent :, null
/ p_sheet pls_integer :, null
:I
##
proce.ure cell
9 p_col pls_integer
/ p_ro2 pls_integer
/ p_1alue .ate
/ p_nu*7*t?. pls_integer :, null
/ p_font?. pls_integer :, null
/ p_fill?. pls_integer :, null
/ p_'or.er?. pls_integer :, null
/ p_align*ent tp_align*ent :, null
/ p_sheet pls_integer :, null
:I
##
proce.ure h(perlink
9 p_col pls_integer
/ p_ro2 pls_integer
/ p_url 1archar%
/ p_1alue 1archar% :, null
/ p_sheet pls_integer :, null
:I
##
proce.ure co**ent
9 p_col pls_integer
/ p_ro2 pls_integer
/ p_text 1archar%
/ p_author 1archar% :, null
/ p_2i.th pls_integer :, !-$ ## pixels
/ p_height pls_integer :, !$$ ## pixels
/ p_sheet pls_integer :, null
:I
##
proce.ure *ergecells
9 p_tl_col pls_integer ## top left
/ p_tl_ro2 pls_integer
/ p_'r_col pls_integer ## 'otto* right
/ p_'r_ro2 pls_integer
/ p_sheet pls_integer :, null
:I
##
proce.ure list_1ali.ation
9 p_sJref_col pls_integer
/ p_sJref_ro2 pls_integer
/ p_tl_col pls_integer ## top left
/ p_tl_ro2 pls_integer
/ p_'r_col pls_integer ## 'otto* right
/ p_'r_ro2 pls_integer
/ p_st(le 1archar% :, 8stop8 ## stop/ 2arning/ infor*ation
/ p_title 1archar% :, null
/ p_pro*pt 1archar :, null
/ p_sho2_error 'oolean :, false
/ p_error_title 1archar% :, null
/ p_error_txt 1archar% :, null
/ p_sheet pls_integer :, null
:I
##
proce.ure list_1ali.ation
9 p_sJref_col pls_integer
/ p_sJref_ro2 pls_integer
/ p_.efine._na*e 1archar%
/ p_st(le 1archar% :, 8stop8 ## stop/ 2arning/ infor*ation
/ p_title 1archar% :, null
/ p_pro*pt 1archar :, null
/ p_sho2_error 'oolean :, false
/ p_error_title 1archar% :, null
/ p_error_txt 1archar% :, null
/ p_sheet pls_integer :, null
:I
##
proce.ure .efine._na*e
9 p_tl_col pls_integer ## top left
/ p_tl_ro2 pls_integer
/ p_'r_col pls_integer ## 'otto* right
/ p_'r_ro2 pls_integer
/ p_na*e 1archar%
/ p_sheet pls_integer :, null
/ p_localsheet pls_integer :, null
:I
##
proce.ure set_colu*n_2i.th
9 p_col pls_integer
/ p_2i.th nu*'er
/ p_sheet pls_integer :, null
:I
##
proce.ure set_colu*n
9 p_col pls_integer
/ p_nu*7*t?. pls_integer :, null
/ p_font?. pls_integer :, null
/ p_fill?. pls_integer :, null
/ p_'or.er?. pls_integer :, null
/ p_align*ent tp_align*ent :, null
/ p_sheet pls_integer :, null
:I
##
proce.ure set_ro2
9 p_ro2 pls_integer
/ p_nu*7*t?. pls_integer :, null
/ p_font?. pls_integer :, null
/ p_fill?. pls_integer :, null
/ p_'or.er?. pls_integer :, null
/ p_align*ent tp_align*ent :, null
/ p_sheet pls_integer :, null
:I
##
proce.ure free0e_ro2s
9 p_nr_ro2s pls_integer :, !
/ p_sheet pls_integer :, null
:I
##
proce.ure free0e_cols
9 p_nr_cols pls_integer :, !
/ p_sheet pls_integer :, null
:I
##
proce.ure set_autofilter
9 p_colu*n_start pls_integer :, null
/ p_colu*n_en. pls_integer :, null
/ p_ro2_start pls_integer :, null
/ p_ro2_en. pls_integer :, null
/ p_sheet pls_integer :, null
:I
##
function finish
return 'lo'I
##
proce.ure sa1e
9 p_.irector( 1archar%
/ p_filena*e 1archar%
:I
##
proce.ure Juer(%sheet
9 p_sJl 1archar%
/ p_colu*n_hea.ers 'oolean :, true
/ p_.irector( 1archar% :, null
/ p_filena*e 1archar% :, null
/ p_sheet pls_integer :, null
:I
##
/* Exa*ple
'egin
as_xlsx)clear_2ork'ookI
as_xlsx)ne2_sheetI
as_xlsx)cell9 -/ !/ - :I
as_xlsx)cell9 4/ !/ 4 :I
as_xlsx)cell9 %/ %/ <- :I
as_xlsx)cell9 4/ %/ 8Anton Scheffer8/ p_align*ent ,K as_xlsx)get_align*ent9 p_2raptext
,K true : :I
as_xlsx)cell9 !/ </ s(s.ate/ p_font?. ,K as_xlsx)get_font9 8Cali'ri8/ p_rg' ,K
87777$$$$8 : :I
as_xlsx)cell9 %/ </ s(s.ate/ p_nu*7*t?. ,K as_xlsx)get_nu*7*t9 8../**/((((
h:**8 : :I
as_xlsx)cell9 4/ </ s(s.ate/ p_nu*7*t?. ,K as_xlsx)get_nu*7*t9 as_xlsx)oraf*t%excel9
8../*on/((((8 : : :I
as_xlsx)cell9 -/ -/ >-/ p_'or.er?. ,K as_xlsx)get_'or.er9 8.ou'le8/ 8.ou'le8/ 8.ou'le8/
8.ou'le8 : :I
as_xlsx)cell9 %/ 4/ 44 :I
as_xlsx)h(perlink9 !/ 3/ 8http://222)a*is)nl8/ 8A*is site8 :I
as_xlsx)cell9 !/ >/ 8So*e *erge. cells8/ p_align*ent ,K
as_xlsx)get_align*ent9 p_hori0ontal ,K 8center8 : :I
as_xlsx)*ergecells9 !/ >/ 4/ > :I
for i in ! )) -
loop
as_xlsx)co**ent9 4/ i L 4/ 8Ro2 8 MM 9iL4:/ 8Anton8 :I
en. loopI
as_xlsx)ne2_sheetI
as_xlsx)set_ro29 !/ p_fill?. ,K as_xlsx)get_fill9 8soli.8/ 87777$$$$8 : : I
for i in ! )) -
loop
as_xlsx)cell9 !/ i/ i :I
as_xlsx)cell9 %/ i/ i * 4 :I
as_xlsx)cell9 4/ i/ 8x 8 MM i * 4 :I
en. loopI
as_xlsx)Juer(%sheet9 8select ro2nu*/ x)*
/ case 2hen *o.9 ro2nu*/ % : , $ then ro2nu* * 4 en. .e*o
/ case 2hen *o.9 ro2nu*/ % : , ! then 88.e*o 88 MM ro2nu* en. .e*o% fro* .ual x
connect '( ro2nu* N, -8 :I
as_xlsx)sa1e9 85E_?R8/ 8*()xlsx8 :I
en.I
##
'egin
as_xlsx)clear_2ork'ookI
as_xlsx)ne2_sheetI
as_xlsx)cell9 !/ 3/ - :I
as_xlsx)cell9 !/ >/ 4 :I
as_xlsx)cell9 !/ ;/ > :I
as_xlsx)ne2_sheetI
as_xlsx)cell9 %/ 3/ !-/ p_sheet ,K % :I
as_xlsx)cell9 %/ >/ !4/ p_sheet ,K % :I
as_xlsx)cell9 %/ ;/ !>/ p_sheet ,K % :I
as_xlsx)list_1ali.ation9 3/ 4/ !/ 3/ !/ ;/ p_sho2_error ,K true/ p_sheet ,K ! :I
as_xlsx).efine._na*e9 %/ 3/ %/ ;/ 8Anton8/ % :I
as_xlsx)list_1ali.ation
9 3/ !/ 8Anton8
/ p_st(le ,K 8infor*ation8
/ p_title ,K 81ali. 1alues are8
/ p_pro*pt ,K 8!4/ !- an. !>8
/ p_sho2_error ,K true
/ p_error_title ,K 8Are (ou sure+8
/ p_error_txt ,K 8Cali. 1alues are: !4/ !- an. !>8
/ p_sheet ,K ! :I
as_xlsx)sa1e9 85E_?R8/ 8*()xlsx8 :I
en.I
##
'egin
as_xlsx)clear_2ork'ookI
as_xlsx)ne2_sheetI
as_xlsx)cell9 !/ 3/ - :I
as_xlsx)cell9 !/ >/ 4 :I
as_xlsx)cell9 !/ ;/ > :I
as_xlsx)set_autofilter9 !/!/ p_ro2_start ,K -/ p_ro2_en. ,K ; :I
as_xlsx)ne2_sheetI
as_xlsx)cell9 %/ 3/ - :I
as_xlsx)cell9 %/ >/ 4 :I
as_xlsx)cell9 %/ ;/ > :I
as_xlsx)set_autofilter9 %/%/ p_ro2_start ,K -/ p_ro2_en. ,K ; :I
as_xlsx)sa1e9 85E_?R8/ 8*()xlsx8 :I
en.I
*/
en.I
/
CREATE OR REPLACE package 'o.( as_xlsx
is
##
c_LOCAL_7?LE_BEAER constant ra29<: :, hextora29 8-$<H$4$<8 :I ## Local
file hea.er signature
c_E6_O7_CE6TRAL_?RECTORE constant ra29<: :, hextora29 8-$<H$-$38 :I ##
En. of central .irector( signature
##
t(pe tp_=7_f*t is recor.
9 nu*7*t?. pls_integer
/ font?. pls_integer
/ fill?. pls_integer
/ 'or.er?. pls_integer
/ align*ent tp_align*ent
:I
t(pe tp_col_f*ts is ta'le of tp_=7_f*t in.ex '( pls_integerI
t(pe tp_ro2_f*ts is ta'le of tp_=7_f*t in.ex '( pls_integerI
t(pe tp_2i.ths is ta'le of nu*'er in.ex '( pls_integerI
t(pe tp_cell is recor.
9 1alue nu*'er
/ st(le 1archar%9-$:
:I
t(pe tp_cells is ta'le of tp_cell in.ex '( pls_integerI
t(pe tp_ro2s is ta'le of tp_cells in.ex '( pls_integerI
t(pe tp_autofilter is recor.
9 colu*n_start pls_integer
/ colu*n_en. pls_integer
/ ro2_start pls_integer
/ ro2_en. pls_integer
:I
t(pe tp_autofilters is ta'le of tp_autofilter in.ex '( pls_integerI
t(pe tp_h(perlink is recor.
9 cell 1archar%9!$:
/ url 1archar%9!$$$:
:I
t(pe tp_h(perlinks is ta'le of tp_h(perlink in.ex '( pls_integerI
su't(pe tp_author is 1archar%94%>3> char:I
t(pe tp_authors is ta'le of pls_integer in.ex '( tp_authorI
authors tp_authorsI
t(pe tp_co**ent is recor.
9 text 1archar%94%>3> char:
/ author tp_author
/ ro2 pls_integer
/ colu*n pls_integer
/ 2i.th pls_integer
/ height pls_integer
:I
t(pe tp_co**ents is ta'le of tp_co**ent in.ex '( pls_integerI
t(pe tp_*ergecells is ta'le of 1archar%9%!: in.ex '( pls_integerI
t(pe tp_1ali.ation is recor.
9 t(pe 1archar%9!$:
/ errorst(le 1archar%94%:
/ sho2input*essage 'oolean
/ pro*pt 1archar%94%>3> char:
/ title 1archar%94%>3> char:
/ error_title 1archar%94%>3> char:
/ error_txt 1archar%94%>3> char:
/ sho2error*essage 'oolean
/ for*ula! 1archar%94%>3> char:
/ for*ula% 1archar%94%>3> char:
/ allo2Hlank 'oolean
/ sJref 1archar%94%>3> char:
:I
t(pe tp_1ali.ations is ta'le of tp_1ali.ation in.ex '( pls_integerI
t(pe tp_sheet is recor.
9 ro2s tp_ro2s
/ 2i.ths tp_2i.ths
/ na*e 1archar%9!$$:
/ free0e_ro2s pls_integer
/ free0e_cols pls_integer
/ autofilters tp_autofilters
/ h(perlinks tp_h(perlinks
/ col_f*ts tp_col_f*ts
/ ro2_f*ts tp_ro2_f*ts
/ co**ents tp_co**ents
/ *ergecells tp_*ergecells
/ 1ali.ations tp_1ali.ations
:I
t(pe tp_sheets is ta'le of tp_sheet in.ex '( pls_integerI
t(pe tp_nu*7*t is recor.
9 nu*7*t?. pls_integer
/ for*atCo.e 1archar%9!$$:
:I
t(pe tp_nu*7*ts is ta'le of tp_nu*7*t in.ex '( pls_integerI
t(pe tp_fill is recor.
9 patternT(pe 1archar%94$:
/ fgRGH 1archar%9;:
:I
t(pe tp_fills is ta'le of tp_fill in.ex '( pls_integerI
t(pe tp_cell=fs is ta'le of tp_xf_f*t in.ex '( pls_integerI
t(pe tp_font is recor.
9 na*e 1archar%9!$$:
/ fa*il( pls_integer
/ fontsi0e nu*'er
/ the*e pls_integer
/ RGH 1archar%9;:
/ un.erline 'oolean
/ italic 'oolean
/ 'ol. 'oolean
:I
t(pe tp_fonts is ta'le of tp_font in.ex '( pls_integerI
t(pe tp_'or.er is recor.
9 top 1archar%9!>:
/ 'otto* 1archar%9!>:
/ left 1archar%9!>:
/ right 1archar%9!>:
:I
t(pe tp_'or.ers is ta'le of tp_'or.er in.ex '( pls_integerI
t(pe tp_nu*7*t?n.exes is ta'le of pls_integer in.ex '( pls_integerI
t(pe tp_strings is ta'le of pls_integer in.ex '( 1archar%94%>3> char:I
t(pe tp_str_in. is ta'le of 1archar%94%>3> char: in.ex '( pls_integerI
t(pe tp_.efine._na*e is recor.
9 na*e 1archar%94%>3> char:
/ ref 1archar%94%>3> char:
/ sheet pls_integer
:I
t(pe tp_.efine._na*es is ta'le of tp_.efine._na*e in.ex '( pls_integerI
t(pe tp_'ook is recor.
9 sheets tp_sheets
/ strings tp_strings
/ str_in. tp_str_in.
/ str_cnt pls_integer :, $
/ fonts tp_fonts
/ fills tp_fills
/ 'or.ers tp_'or.ers
/ nu*7*ts tp_nu*7*ts
/ cell=fs tp_cell=fs
/ nu*7*t?n.exes tp_nu*7*t?n.exes
/ .efine._na*es tp_.efine._na*es
:I
2ork'ook tp_'ookI
##
proce.ure 'lo'%file
9 p_'lo' 'lo'
/ p_.irector( 1archar% :, 85E_?R8
/ p_filena*e 1archar% :, 8*()xlsx8
:
is
t_fh utl_file)file_t(peI
t_len pls_integer :, 4%>3>I
'egin
t_fh :, utl_file)fopen9 p_.irector(
/ p_filena*e
/ 82'8
:I
for i in $ )) trunc9 9 .'*s_lo')getlength9 p_'lo' : # ! : / t_len :
loop
utl_file)put_ra29 t_fh
/ .'*s_lo')su'str9 p_'lo'
/ t_len
/ i * t_len L !
:
:I
en. loopI
utl_file)fclose9 t_fh :I
en.I
##
function ra2%nu*9 p_ra2 ra2/ p_len integer/ p_pos integer :
return nu*'er
is
'egin
return utl_ra2)cast_to_'inar(_integer9 utl_ra2)su'str9 p_ra2/ p_pos/ p_len :/
utl_ra2)little_en.ian :I
en.I
##
function little_en.ian9 p_'ig nu*'er/ p_'(tes pls_integer :, < :
return ra2
is
'egin
return utl_ra2)su'str9 utl_ra2)cast_fro*_'inar(_integer9 p_'ig/ utl_ra2)little_en.ian :/
!/ p_'(tes :I
en.I
##
function 'lo'%nu*9 p_'lo' 'lo'/ p_len integer/ p_pos integer :
return nu*'er
is
'egin
return utl_ra2)cast_to_'inar(_integer9 .'*s_lo')su'str9 p_'lo'/ p_len/ p_pos :/
utl_ra2)little_en.ian :I
en.I
##
proce.ure a..!file
9 p_0ippe._'lo' in out 'lo'
/ p_na*e 1archar%
/ p_content 'lo'
:
is
t_no2 .ateI
t_'lo' 'lo'I
t_len integerI
t_clen integerI
t_crc4% ra29<: :, hextora29 8$$$$$$$$8 :I
t_co*presse. 'oolean :, falseI
t_na*e ra294%>3>:I
'egin
t_no2 :, s(s.ateI
t_len :, n1l9 .'*s_lo')getlength9 p_content :/ $ :I
if t_len K $
then
t_'lo' :, utl_co*press)l0_co*press9 p_content :I
t_clen :, .'*s_lo')getlength9 t_'lo' : # !;I
t_co*presse. :, t_clen N t_lenI
t_crc4% :, .'*s_lo')su'str9 t_'lo'/ </ t_clen L !! :I
en. ifI
if not t_co*presse.
then
t_clen :, t_lenI
t_'lo' :, p_contentI
en. ifI
if p_0ippe._'lo' is null
then
.'*s_lo')createte*porar(9 p_0ippe._'lo'/ true :I
en. ifI
t_na*e :, utl_i!;n)string_to_ra29 p_na*e/ 8AL4%DT7;8 :I
.'*s_lo')appen.9 p_0ippe._'lo'
/ utl_ra2)concat9 c_LOCAL_7?LE_BEAER ## Local file hea.er signature
/ hextora29 8!<$$8 : ## 1ersion %)$
/ case 2hen t_na*e , utl_i!;n)string_to_ra29 p_na*e/ 8DS;PC<4>8
:
then hextora29 8$$$$8 : ## no General purpose 'its
else hextora29 8$$$;8 : ## set Language enco.ing flag 9E7S:
en.
/ case 2hen t_co*presse.
then hextora29 8$;$$8 : ## .eflate
else hextora29 8$$$$8 : ## store.
en.
/ little_en.ian9 to_nu*'er9 to_char9 t_no2/ 8ss8 : : / %
L to_nu*'er9 to_char9 t_no2/ 8*i8 : : * 4%
L to_nu*'er9 to_char9 t_no2/ 8hh%<8 : : * %$<;
/ %
: ## 7ile last *o.ification ti*e
/ little_en.ian9 to_nu*'er9 to_char9 t_no2/ 8..8 : :
L to_nu*'er9 to_char9 t_no2/ 8**8 : : * 4%
L 9 to_nu*'er9 to_char9 t_no2/ 8((((8 : : # !";$ : * -!%
/ %
: ## 7ile last *o.ification .ate
/ t_crc4% ## CRC#4%
/ little_en.ian9 t_clen : ## co*presse. si0e
/ little_en.ian9 t_len : ## unco*presse. si0e
/ little_en.ian9 utl_ra2)length9 t_na*e :/ % : ## 7ile na*e length
/ hextora29 8$$$$8 : ## Extra fiel. length
/ t_na*e ## 7ile na*e
:
:I
if t_co*presse.
then
.'*s_lo')cop(9 p_0ippe._'lo'/ t_'lo'/ t_clen/ .'*s_lo')getlength9 p_0ippe._'lo' :
L !/ !! :I ## co*presse. content
elsif t_clen K $
then
.'*s_lo')cop(9 p_0ippe._'lo'/ t_'lo'/ t_clen/ .'*s_lo')getlength9 p_0ippe._'lo' :
L !/ ! :I ## content
en. ifI
if .'*s_lo')iste*porar(9 t_'lo' : , !
then
.'*s_lo')freete*porar(9 t_'lo' :I
en. ifI
en.I
##
proce.ure finish_0ip9 p_0ippe._'lo' in out 'lo' :
is
t_cnt pls_integer :, $I
t_offs integerI
t_offs_.ir_hea.er integerI
t_offs_en._hea.er integerI
t_co**ent ra294%>3>: :, utl_ra2)cast_to_ra29 8?*ple*entation '( Anton Scheffer8 :I
'egin
t_offs_.ir_hea.er :, .'*s_lo')getlength9 p_0ippe._'lo' :I
t_offs :, !I
2hile .'*s_lo')su'str9 p_0ippe._'lo'/ utl_ra2)length9 c_LOCAL_7?LE_BEAER :/
t_offs : , c_LOCAL_7?LE_BEAER
loop
t_cnt :, t_cnt L !I
.'*s_lo')appen.9 p_0ippe._'lo'
/ utl_ra2)concat9 hextora29 8-$<H$!$%8 : ## Central .irector( file hea.er
signature
/ hextora29 8!<$$8 : ## 1ersion %)$
/ .'*s_lo')su'str9 p_0ippe._'lo'/ %3/ t_offs L < :
/ hextora29 8$$$$8 : ## 7ile co**ent length
/ hextora29 8$$$$8 : ## isk nu*'er 2here file starts
/ hextora29 8$$$$8 : ## ?nternal file attri'utes ,K
## $$$$ 'inar( file
## $!$$ 9ascii:text file
/ case
2hen .'*s_lo')su'str9 p_0ippe._'lo'
/ !
/ t_offs L 4$ L 'lo'%nu*9 p_0ippe._'lo'/ %/ t_offs
L %3 : # !
: in 9 hextora29 8%78 : ## /
/ hextora29 8-C8 : ## O
:
then hextora29 8!$$$$$$$8 : ## a .irector(/fol.er
else hextora29 8%$$$H3;!8 : ## a file
en. ## External file attri'utes
/ little_en.ian9 t_offs # ! : ## Relati1e offset of local file hea.er
/ .'*s_lo')su'str9 p_0ippe._'lo'
/ 'lo'%nu*9 p_0ippe._'lo'/ %/ t_offs L %3 :
/ t_offs L 4$
: ## 7ile na*e
:
:I
t_offs :, t_offs L 4$ L 'lo'%nu*9 p_0ippe._'lo'/ </ t_offs L !; : ## co*presse. si0e
L 'lo'%nu*9 p_0ippe._'lo'/ %/ t_offs L %3 : ## 7ile na*e length
L 'lo'%nu*9 p_0ippe._'lo'/ %/ t_offs L %; :I ## Extra fiel. length
en. loopI
t_offs_en._hea.er :, .'*s_lo')getlength9 p_0ippe._'lo' :I
.'*s_lo')appen.9 p_0ippe._'lo'
/ utl_ra2)concat9 c_E6_O7_CE6TRAL_?RECTORE
## En. of central .irector( signature
/ hextora29 8$$$$8 : ## 6u*'er of this .isk
/ hextora29 8$$$$8 : ## isk 2here central
.irector( starts
/ little_en.ian9 t_cnt/ % : ## 6u*'er of central
.irector( recor.s on this .isk
/ little_en.ian9 t_cnt/ % : ## Total nu*'er of
central .irector( recor.s
/ little_en.ian9 t_offs_en._hea.er # t_offs_.ir_hea.er : ## Si0e of
central .irector(
/ little_en.ian9 t_offs_.ir_hea.er : ## Offset of start
of central .irector(/ relati1e to start of archi1e
/ little_en.ian9 n1l9 utl_ra2)length9 t_co**ent :/ $ :/ % : ## P?P file
co**ent length
/ t_co**ent
:
:I
en.I
##
function alfan_col9 p_col pls_integer :
return 1archar%
is
'egin
return case
2hen p_col K >$% then chr9 3< L trunc9 9 p_col # %> : / 3>3 : : MM chr9 3- L
*o.9 trunc9 9 p_col # ! : / %3 : # !/ %3 : : MM chr9 3- L *o.9 p_col # !/ %3 : :
2hen p_col K %3 then chr9 3< L trunc9 9 p_col # ! : / %3 : : MM chr9 3- L
*o.9 p_col # !/ %3 : :
else chr9 3< L p_col :
en.I
en.I
##
function col_alfan9 p_col 1archar% :
return pls_integer
is
'egin
return ascii9 su'str9 p_col/ #! : : # 3<
L n1l9 9 ascii9 su'str9 p_col/ #%/ ! : : # 3< : * %3/ $ :
L n1l9 9 ascii9 su'str9 p_col/ #4/ ! : : # 3< : * 3>3/ $ :I
en.I
##
proce.ure clear_2ork'ook
is
t_ro2_in. pls_integerI
'egin
for s in ! )) 2ork'ook)sheets)count9:
loop
t_ro2_in. :, 2ork'ook)sheets9 s :)ro2s)first9:I
2hile t_ro2_in. is not null
loop
2ork'ook)sheets9 s :)ro2s9 t_ro2_in. :).elete9:I
t_ro2_in. :, 2ork'ook)sheets9 s :)ro2s)next9 t_ro2_in. :I
en. loopI
2ork'ook)sheets9 s :)ro2s).elete9:I
2ork'ook)sheets9 s :)2i.ths).elete9:I
2ork'ook)sheets9 s :)autofilters).elete9:I
2ork'ook)sheets9 s :)h(perlinks).elete9:I
2ork'ook)sheets9 s :)col_f*ts).elete9:I
2ork'ook)sheets9 s :)ro2_f*ts).elete9:I
2ork'ook)sheets9 s :)co**ents).elete9:I
2ork'ook)sheets9 s :)*ergecells).elete9:I
2ork'ook)sheets9 s :)1ali.ations).elete9:I
en. loopI
2ork'ook)strings).elete9:I
2ork'ook)str_in.).elete9:I
2ork'ook)fonts).elete9:I
2ork'ook)fills).elete9:I
2ork'ook)'or.ers).elete9:I
2ork'ook)nu*7*ts).elete9:I
2ork'ook)cell=fs).elete9:I
2ork'ook).efine._na*es).elete9:I
2ork'ook :, nullI
en.I
##
proce.ure ne2_sheet9 p_sheetna*e 1archar% :, null :
is
t_nr pls_integer :, 2ork'ook)sheets)count9: L !I
t_in. pls_integerI
'egin
2ork'ook)sheets9 t_nr :)na*e :, n1l9 .'*s_x*lgen)con1ert9 translate9 p_sheetna*e/
8a/OQR*:+8/ 8a8 : :/ 8Sheet8 MM t_nr :I
if 2ork'ook)strings)count9: , $
then
2ork'ook)str_cnt :, $I
en. ifI
if 2ork'ook)fonts)count9: , $
then
t_in. :, get_font9 8Cali'ri8 :I
en. ifI
if 2ork'ook)fills)count9: , $
then
t_in. :, get_fill9 8none8 :I
t_in. :, get_fill9 8gra(!%-8 :I
en. ifI
if 2ork'ook)'or.ers)count9: , $
then
t_in. :, get_'or.er9 88/ 88/ 88/ 88 :I
en. ifI
en.I
##
proce.ure set_col_2i.th
9 p_sheet pls_integer
/ p_col pls_integer
/ p_for*at 1archar%
:
is
t_2i.th nu*'erI
t_nr_chr pls_integerI
'egin
if p_for*at is null
then
returnI
en. ifI
if instr9 p_for*at/ 8I8 : K $
then
t_nr_chr :, length9 translate9 su'str9 p_for*at/ !/ instr9 p_for*at/ 8I8 : # ! :/ 8aO@8/ 8a8 : :I
else
t_nr_chr :, length9 translate9 p_for*at/ 8aO@8/ 8a8 : :I
en. ifI
t_2i.th :, trunc9 9 t_nr_chr * > L - : / > * %-3 : / %-3I ## assu*e .efault !! point
Cali'ri
if 2ork'ook)sheets9 p_sheet :)2i.ths)exists9 p_col :
then
2ork'ook)sheets9 p_sheet :)2i.ths9 p_col : :,
greatest9 2ork'ook)sheets9 p_sheet :)2i.ths9 p_col :
/ t_2i.th
:I
else
2ork'ook)sheets9 p_sheet :)2i.ths9 p_col : :, greatest9 t_2i.th/ ;)<4 :I
en. ifI
en.I
##
function Ora7*t%Excel9 p_for*at 1archar% :, null :
return 1archar%
is
t_for*at 1archar%9!$$$: :, su'str9 p_for*at/ !/ !$$$ :I
'egin
t_for*at :, replace9 replace9 t_for*at/ 8hh%<8/ 8hh8 :/ 8hh!%8/ 8hh8 :I
t_for*at :, replace9 t_for*at/ 8*i8/ 8**8 :I
t_for*at :, replace9 replace9 replace9 t_for*at/ 8A58/ 8SS8 :/ 8P58/ 8SS8 :/ 8SS8/
8A5/P58 :I
t_for*at :, replace9 replace9 replace9 t_for*at/ 8a*8/ 8SS8 :/ 8p*8/ 8SS8 :/ 8SS8/ 8A5/P58 :I
t_for*at :, replace9 replace9 t_for*at/ 8.a(8/ 8AE8 :/ 8AE8/ 8....8 :I
t_for*at :, replace9 replace9 t_for*at/ 8.(8/ 8E8 :/ 8AE8/ 8...8 :I
t_for*at :, replace9 replace9 t_for*at/ 8RR8/ 8RR8 :/ 8RR8/ 8EE8 :I
t_for*at :, replace9 replace9 t_for*at/ 8*onth8/ 85O6TB8 :/ 85O6TB8/ 8****8 :I
t_for*at :, replace9 replace9 t_for*at/ 8*on8/ 85O68 :/ 85O68/ 8***8 :I
return t_for*atI
en.I
##
function get_nu*7*t9 p_for*at 1archar% :, null :
return pls_integer
is
t_cnt pls_integerI
t_nu*7*t?. pls_integerI
'egin
if p_for*at is null
then
return $I
en. ifI
t_cnt :, 2ork'ook)nu*7*ts)count9:I
for i in ! )) t_cnt
loop
if 2ork'ook)nu*7*ts9 i :)for*atCo.e , p_for*at
then
t_nu*7*t?. :, 2ork'ook)nu*7*ts9 i :)nu*7*t?.I
exitI
en. ifI
en. loopI
if t_nu*7*t?. is null
then
t_nu*7*t?. :, case 2hen t_cnt , $ then !3< else
2ork'ook)nu*7*ts9 t_cnt :)nu*7*t?. L ! en.I
t_cnt :, t_cnt L !I
2ork'ook)nu*7*ts9 t_cnt :)nu*7*t?. :, t_nu*7*t?.I
2ork'ook)nu*7*ts9 t_cnt :)for*atCo.e :, p_for*atI
2ork'ook)nu*7*t?n.exes9 t_nu*7*t?. : :, t_cntI
en. ifI
return t_nu*7*t?.I
en.I
##
function get_font
9 p_na*e 1archar%
/ p_fa*il( pls_integer :, %
/ p_fontsi0e nu*'er :, !!
/ p_the*e pls_integer :, !
/ p_un.erline 'oolean :, false
/ p_italic 'oolean :, false
/ p_'ol. 'oolean :, false
/ p_rg' 1archar% :, null ## this is a hex ALPBA Re. Green Hlue 1alue
:
return pls_integer
is
t_in. pls_integerI
'egin
if 2ork'ook)fonts)count9: K $
then
for f in $ )) 2ork'ook)fonts)count9: # !
loop
if 9 2ork'ook)fonts9 f :)na*e , p_na*e
an. 2ork'ook)fonts9 f :)fa*il( , p_fa*il(
an. 2ork'ook)fonts9 f :)fontsi0e , p_fontsi0e
an. 2ork'ook)fonts9 f :)the*e , p_the*e
an. 2ork'ook)fonts9 f :)un.erline , p_un.erline
an. 2ork'ook)fonts9 f :)italic , p_italic
an. 2ork'ook)fonts9 f :)'ol. , p_'ol.
an. 9 2ork'ook)fonts9 f :)rg' , p_rg'
or 9 2ork'ook)fonts9 f :)rg' is null an. p_rg' is null :
:
:
then
return fI
en. ifI
en. loopI
en. ifI
t_in. :, 2ork'ook)fonts)count9:I
2ork'ook)fonts9 t_in. :)na*e :, p_na*eI
2ork'ook)fonts9 t_in. :)fa*il( :, p_fa*il(I
2ork'ook)fonts9 t_in. :)fontsi0e :, p_fontsi0eI
2ork'ook)fonts9 t_in. :)the*e :, p_the*eI
2ork'ook)fonts9 t_in. :)un.erline :, p_un.erlineI
2ork'ook)fonts9 t_in. :)italic :, p_italicI
2ork'ook)fonts9 t_in. :)'ol. :, p_'ol.I
2ork'ook)fonts9 t_in. :)rg' :, p_rg'I
return t_in.I
en.I
##
function get_fill
9 p_patternT(pe 1archar%
/ p_fgRGH 1archar% :, null
:
return pls_integer
is
t_in. pls_integerI
'egin
if 2ork'ook)fills)count9: K $
then
for f in $ )) 2ork'ook)fills)count9: # !
loop
if 9 2ork'ook)fills9 f :)patternT(pe , p_patternT(pe
an. n1l9 2ork'ook)fills9 f :)fgRGH/ 8x8 : , n1l9 upper9 p_fgRGH :/ 8x8 :
:
then
return fI
en. ifI
en. loopI
en. ifI
t_in. :, 2ork'ook)fills)count9:I
2ork'ook)fills9 t_in. :)patternT(pe :, p_patternT(peI
2ork'ook)fills9 t_in. :)fgRGH :, upper9 p_fgRGH :I
return t_in.I
en.I
##
function get_'or.er
9 p_top 1archar% :, 8thin8
/ p_'otto* 1archar% :, 8thin8
/ p_left 1archar% :, 8thin8
/ p_right 1archar% :, 8thin8
:
return pls_integer
is
t_in. pls_integerI
'egin
if 2ork'ook)'or.ers)count9: K $
then
for ' in $ )) 2ork'ook)'or.ers)count9: # !
loop
if 9 n1l9 2ork'ook)'or.ers9 ' :)top/ 8x8 : , n1l9 p_top/ 8x8 :
an. n1l9 2ork'ook)'or.ers9 ' :)'otto*/ 8x8 : , n1l9 p_'otto*/ 8x8 :
an. n1l9 2ork'ook)'or.ers9 ' :)left/ 8x8 : , n1l9 p_left/ 8x8 :
an. n1l9 2ork'ook)'or.ers9 ' :)right/ 8x8 : , n1l9 p_right/ 8x8 :
:
then
return 'I
en. ifI
en. loopI
en. ifI
t_in. :, 2ork'ook)'or.ers)count9:I
2ork'ook)'or.ers9 t_in. :)top :, p_topI
2ork'ook)'or.ers9 t_in. :)'otto* :, p_'otto*I
2ork'ook)'or.ers9 t_in. :)left :, p_leftI
2ork'ook)'or.ers9 t_in. :)right :, p_rightI
return t_in.I
en.I
##
function get_align*ent
9 p_1ertical 1archar% :, null
/ p_hori0ontal 1archar% :, null
/ p_2rapText 'oolean :, null
:
return tp_align*ent
is
t_r1 tp_align*entI
'egin
t_r1)1ertical :, p_1erticalI
t_r1)hori0ontal :, p_hori0ontalI
t_r1)2rapText :, p_2rapTextI
return t_r1I
en.I
##
function get_=f?.
9 p_sheet pls_integer
/ p_col pls_integer
/ p_ro2 pls_integer
/ p_nu*7*t?. pls_integer :, null
/ p_font?. pls_integer :, null
/ p_fill?. pls_integer :, null
/ p_'or.er?. pls_integer :, null
/ p_align*ent tp_align*ent :, null
:
return 1archar%
is
t_cnt pls_integerI
t_=f?. pls_integerI
t_=7 tp_=7_f*tI
t_col_=7 tp_=7_f*tI
t_ro2_=7 tp_=7_f*tI
'egin
if 2ork'ook)sheets9 p_sheet :)col_f*ts)exists9 p_col :
then
t_col_=7 :, 2ork'ook)sheets9 p_sheet :)col_f*ts9 p_col :I
en. ifI
if 2ork'ook)sheets9 p_sheet :)ro2_f*ts)exists9 p_ro2 :
then
t_ro2_=7 :, 2ork'ook)sheets9 p_sheet :)ro2_f*ts9 p_ro2 :I
en. ifI
t_=7)nu*7*t?. :, coalesce9 p_nu*7*t?./ t_col_=7)nu*7*t?./ t_ro2_=7)nu*7*t?./
$ :I
t_=7)font?. :, coalesce9 p_font?./ t_col_=7)font?./ t_ro2_=7)font?./ $ :I
t_=7)fill?. :, coalesce9 p_fill?./ t_col_=7)fill?./ t_ro2_=7)fill?./ $ :I
t_=7)'or.er?. :, coalesce9 p_'or.er?./ t_col_=7)'or.er?./ t_ro2_=7)'or.er?./ $ :I
t_=7)align*ent :, coalesce9 p_align*ent/ t_col_=7)align*ent/ t_ro2_=7)align*ent :I
if 9 t_=7)nu*7*t?. L t_=7)font?. L t_=7)fill?. L t_=7)'or.er?. , $
an. t_=7)align*ent)1ertical is null
an. t_=7)align*ent)hori0ontal is null
an. not n1l9 t_=7)align*ent)2rapText/ false :
:
then
return 88I
en. ifI
if t_=7)nu*7*t?. K $
then
set_col_2i.th9 p_sheet/ p_col/
2ork'ook)nu*7*ts9 2ork'ook)nu*7*t?n.exes9 t_=7)nu*7*t?. : :)for*atCo.e :I
en. ifI
t_cnt :, 2ork'ook)cell=fs)count9:I
for i in ! )) t_cnt
loop
if 9 2ork'ook)cell=fs9 i :)nu*7*t?. , t_=7)nu*7*t?.
an. 2ork'ook)cell=fs9 i :)font?. , t_=7)font?.
an. 2ork'ook)cell=fs9 i :)fill?. , t_=7)fill?.
an. 2ork'ook)cell=fs9 i :)'or.er?. , t_=7)'or.er?.
an. n1l9 2ork'ook)cell=fs9 i :)align*ent)1ertical/ 8x8 : ,
n1l9 t_=7)align*ent)1ertical/ 8x8 :
an. n1l9 2ork'ook)cell=fs9 i :)align*ent)hori0ontal/ 8x8 : ,
n1l9 t_=7)align*ent)hori0ontal/ 8x8 :
an. n1l9 2ork'ook)cell=fs9 i :)align*ent)2rapText/ false : ,
n1l9 t_=7)align*ent)2rapText/ false :
:
then
t_=f?. :, iI
exitI
en. ifI
en. loopI
if t_=f?. is null
then
t_cnt :, t_cnt L !I
t_=f?. :, t_cntI
2ork'ook)cell=fs9 t_cnt : :, t_=7I
en. ifI
return 8s,@8 MM t_=f?. MM 8@8I
en.I
##
proce.ure cell
9 p_col pls_integer
/ p_ro2 pls_integer
/ p_1alue nu*'er
/ p_nu*7*t?. pls_integer :, null
/ p_font?. pls_integer :, null
/ p_fill?. pls_integer :, null
/ p_'or.er?. pls_integer :, null
/ p_align*ent tp_align*ent :, null
/ p_sheet pls_integer :, null
:
is
t_sheet pls_integer :, n1l9 p_sheet/ 2ork'ook)sheets)count9: :I
'egin
2ork'ook)sheets9 t_sheet :)ro2s9 p_ro2 :9 p_col :)1alue :, p_1alueI
2ork'ook)sheets9 t_sheet :)ro2s9 p_ro2 :9 p_col :)st(le :, nullI
2ork'ook)sheets9 t_sheet :)ro2s9 p_ro2 :9 p_col :)st(le :, get_=f?.9 t_sheet/ p_col/
p_ro2/ p_nu*7*t?./ p_font?./ p_fill?./ p_'or.er?./ p_align*ent :I
en.I
##
function a.._string9 p_string 1archar% :
return pls_integer
is
t_cnt pls_integerI
'egin
if 2ork'ook)strings)exists9 p_string :
then
t_cnt :, 2ork'ook)strings9 p_string :I
else
t_cnt :, 2ork'ook)strings)count9:I
2ork'ook)str_in.9 t_cnt : :, p_stringI
2ork'ook)strings9 n1l9 p_string/ 88 : : :, t_cntI
en. ifI
2ork'ook)str_cnt :, 2ork'ook)str_cnt L !I
return t_cntI
en.I
##
proce.ure cell
9 p_col pls_integer
/ p_ro2 pls_integer
/ p_1alue 1archar%
/ p_nu*7*t?. pls_integer :, null
/ p_font?. pls_integer :, null
/ p_fill?. pls_integer :, null
/ p_'or.er?. pls_integer :, null
/ p_align*ent tp_align*ent :, null
/ p_sheet pls_integer :, null
:
is
t_sheet pls_integer :, n1l9 p_sheet/ 2ork'ook)sheets)count9: :I
t_align*ent tp_align*ent :, p_align*entI
'egin
2ork'ook)sheets9 t_sheet :)ro2s9 p_ro2 :9 p_col :)1alue :, a.._string9 p_1alue :I
if t_align*ent)2rapText is null an. instr9 p_1alue/ chr9!4: : K $
then
t_align*ent)2rapText :, trueI
en. ifI
2ork'ook)sheets9 t_sheet :)ro2s9 p_ro2 :9 p_col :)st(le :, 8t,@s@ 8 MM get_=f?.9 t_sheet/
p_col/ p_ro2/ p_nu*7*t?./ p_font?./ p_fill?./ p_'or.er?./ t_align*ent :I
en.I
##
proce.ure cell
9 p_col pls_integer
/ p_ro2 pls_integer
/ p_1alue .ate
/ p_nu*7*t?. pls_integer :, null
/ p_font?. pls_integer :, null
/ p_fill?. pls_integer :, null
/ p_'or.er?. pls_integer :, null
/ p_align*ent tp_align*ent :, null
/ p_sheet pls_integer :, null
:
is
t_nu*7*t?. pls_integer :, p_nu*7*t?.I
t_sheet pls_integer :, n1l9 p_sheet/ 2ork'ook)sheets)count9: :I
'egin
2ork'ook)sheets9 t_sheet :)ro2s9 p_ro2 :9 p_col :)1alue :, p_1alue # to_.ate98$!#$!#
!"$<8/8#55#EEEE8:I
if t_nu*7*t?. is null
an. not 9 2ork'ook)sheets9 t_sheet :)col_f*ts)exists9 p_col :
an. 2ork'ook)sheets9 t_sheet :)col_f*ts9 p_col :)nu*7*t?. is not null
:
an. not 9 2ork'ook)sheets9 t_sheet :)ro2_f*ts)exists9 p_ro2 :
an. 2ork'ook)sheets9 t_sheet :)ro2_f*ts9 p_ro2 :)nu*7*t?. is not null
:
then
t_nu*7*t?. :, get_nu*7*t9 8../**/((((8 :I
en. ifI
2ork'ook)sheets9 t_sheet :)ro2s9 p_ro2 :9 p_col :)st(le :, get_=f?.9 t_sheet/ p_col/
p_ro2/ t_nu*7*t?./ p_font?./ p_fill?./ p_'or.er?./ p_align*ent :I
en.I
##
proce.ure h(perlink
9 p_col pls_integer
/ p_ro2 pls_integer
/ p_url 1archar%
/ p_1alue 1archar% :, null
/ p_sheet pls_integer :, null
:
is
t_in. pls_integerI
t_sheet pls_integer :, n1l9 p_sheet/ 2ork'ook)sheets)count9: :I
'egin
2ork'ook)sheets9 t_sheet :)ro2s9 p_ro2 :9 p_col :)1alue :, a.._string9 n1l9 p_1alue/
p_url : :I
2ork'ook)sheets9 t_sheet :)ro2s9 p_ro2 :9 p_col :)st(le :, 8t,@s@ 8 MM get_=f?.9 t_sheet/
p_col/ p_ro2/ 88/ get_font9 8Cali'ri8/ p_the*e ,K !$/ p_un.erline ,K true : :I
t_in. :, 2ork'ook)sheets9 t_sheet :)h(perlinks)count9: L !I
2ork'ook)sheets9 t_sheet :)h(perlinks9 t_in. :)cell :, alfan_col9 p_col : MM p_ro2I
2ork'ook)sheets9 t_sheet :)h(perlinks9 t_in. :)url :, p_urlI
en.I
##
proce.ure co**ent
9 p_col pls_integer
/ p_ro2 pls_integer
/ p_text 1archar%
/ p_author 1archar% :, null
/ p_2i.th pls_integer :, !-$
/ p_height pls_integer :, !$$
/ p_sheet pls_integer :, null
:
is
t_in. pls_integerI
t_sheet pls_integer :, n1l9 p_sheet/ 2ork'ook)sheets)count9: :I
'egin
t_in. :, 2ork'ook)sheets9 t_sheet :)co**ents)count9: L !I
2ork'ook)sheets9 t_sheet :)co**ents9 t_in. :)ro2 :, p_ro2I
2ork'ook)sheets9 t_sheet :)co**ents9 t_in. :)colu*n :, p_colI
2ork'ook)sheets9 t_sheet :)co**ents9 t_in. :)text :, .'*s_x*lgen)con1ert9 p_text :I
2ork'ook)sheets9 t_sheet :)co**ents9 t_in. :)author :,
.'*s_x*lgen)con1ert9 p_author :I
2ork'ook)sheets9 t_sheet :)co**ents9 t_in. :)2i.th :, p_2i.thI
2ork'ook)sheets9 t_sheet :)co**ents9 t_in. :)height :, p_heightI
en.I
##
proce.ure *ergecells
9 p_tl_col pls_integer ## top left
/ p_tl_ro2 pls_integer
/ p_'r_col pls_integer ## 'otto* right
/ p_'r_ro2 pls_integer
/ p_sheet pls_integer :, null
:
is
t_in. pls_integerI
t_sheet pls_integer :, n1l9 p_sheet/ 2ork'ook)sheets)count9: :I
'egin
t_in. :, 2ork'ook)sheets9 t_sheet :)*ergecells)count9: L !I
2ork'ook)sheets9 t_sheet :)*ergecells9 t_in. : :, alfan_col9 p_tl_col : MM p_tl_ro2 MM 8:8 MM
alfan_col9 p_'r_col : MM p_'r_ro2I
en.I
##
proce.ure a.._1ali.ation
9 p_t(pe 1archar%
/ p_sJref 1archar%
/ p_st(le 1archar% :, 8stop8 ## stop/ 2arning/ infor*ation
/ p_for*ula! 1archar% :, null
/ p_for*ula% 1archar% :, null
/ p_title 1archar% :, null
/ p_pro*pt 1archar :, null
/ p_sho2_error 'oolean :, false
/ p_error_title 1archar% :, null
/ p_error_txt 1archar% :, null
/ p_sheet pls_integer :, null
:
is
t_in. pls_integerI
t_sheet pls_integer :, n1l9 p_sheet/ 2ork'ook)sheets)count9: :I
'egin
t_in. :, 2ork'ook)sheets9 t_sheet :)1ali.ations)count9: L !I
2ork'ook)sheets9 t_sheet :)1ali.ations9 t_in. :)t(pe :, p_t(peI
2ork'ook)sheets9 t_sheet :)1ali.ations9 t_in. :)errorst(le :, p_st(leI
2ork'ook)sheets9 t_sheet :)1ali.ations9 t_in. :)sJref :, p_sJrefI
2ork'ook)sheets9 t_sheet :)1ali.ations9 t_in. :)for*ula! :, p_for*ula!I
2ork'ook)sheets9 t_sheet :)1ali.ations9 t_in. :)error_title :, p_error_titleI
2ork'ook)sheets9 t_sheet :)1ali.ations9 t_in. :)error_txt :, p_error_txtI
2ork'ook)sheets9 t_sheet :)1ali.ations9 t_in. :)title :, p_titleI
2ork'ook)sheets9 t_sheet :)1ali.ations9 t_in. :)pro*pt :, p_pro*ptI
2ork'ook)sheets9 t_sheet :)1ali.ations9 t_in. :)sho2error*essage :, p_sho2_errorI
en.I
##
proce.ure list_1ali.ation
9 p_sJref_col pls_integer
/ p_sJref_ro2 pls_integer
/ p_tl_col pls_integer ## top left
/ p_tl_ro2 pls_integer
/ p_'r_col pls_integer ## 'otto* right
/ p_'r_ro2 pls_integer
/ p_st(le 1archar% :, 8stop8 ## stop/ 2arning/ infor*ation
/ p_title 1archar% :, null
/ p_pro*pt 1archar :, null
/ p_sho2_error 'oolean :, false
/ p_error_title 1archar% :, null
/ p_error_txt 1archar% :, null
/ p_sheet pls_integer :, null
:
is
'egin
a.._1ali.ation9 8list8
/ alfan_col9 p_sJref_col : MM p_sJref_ro2
/ p_st(le ,K lo2er9 p_st(le :
/ p_for*ula! ,K 8T8 MM alfan_col9 p_tl_col : MM 8T8 MM p_tl_ro2 MM 8:T8 MM
alfan_col9 p_'r_col : MM 8T8 MM p_'r_ro2
/ p_title ,K p_title
/ p_pro*pt ,K p_pro*pt
/ p_sho2_error ,K p_sho2_error
/ p_error_title ,K p_error_title
/ p_error_txt ,K p_error_txt
/ p_sheet ,K p_sheet
:I
en.I
##
proce.ure list_1ali.ation
9 p_sJref_col pls_integer
/ p_sJref_ro2 pls_integer
/ p_.efine._na*e 1archar%
/ p_st(le 1archar% :, 8stop8 ## stop/ 2arning/ infor*ation
/ p_title 1archar% :, null
/ p_pro*pt 1archar :, null
/ p_sho2_error 'oolean :, false
/ p_error_title 1archar% :, null
/ p_error_txt 1archar% :, null
/ p_sheet pls_integer :, null
:
is
'egin
a.._1ali.ation9 8list8
/ alfan_col9 p_sJref_col : MM p_sJref_ro2
/ p_st(le ,K lo2er9 p_st(le :
/ p_for*ula! ,K p_.efine._na*e
/ p_title ,K p_title
/ p_pro*pt ,K p_pro*pt
/ p_sho2_error ,K p_sho2_error
/ p_error_title ,K p_error_title
/ p_error_txt ,K p_error_txt
/ p_sheet ,K p_sheet
:I
en.I
##
proce.ure .efine._na*e
9 p_tl_col pls_integer ## top left
/ p_tl_ro2 pls_integer
/ p_'r_col pls_integer ## 'otto* right
/ p_'r_ro2 pls_integer
/ p_na*e 1archar%
/ p_sheet pls_integer :, null
/ p_localsheet pls_integer :, null
:
is
t_in. pls_integerI
t_sheet pls_integer :, n1l9 p_sheet/ 2ork'ook)sheets)count9: :I
'egin
t_in. :, 2ork'ook).efine._na*es)count9: L !I
2ork'ook).efine._na*es9 t_in. :)na*e :, p_na*eI
2ork'ook).efine._na*es9 t_in. :)ref :, 8Sheet8 MM t_sheet MM 8UT8 MM alfan_col9 p_tl_col : MM
8T8 MM p_tl_ro2 MM 8:T8 MM alfan_col9 p_'r_col : MM 8T8 MM p_'r_ro2I
2ork'ook).efine._na*es9 t_in. :)sheet :, p_localsheetI
en.I
##
proce.ure set_colu*n_2i.th
9 p_col pls_integer
/ p_2i.th nu*'er
/ p_sheet pls_integer :, null
:
is
'egin
2ork'ook)sheets9 n1l9 p_sheet/ 2ork'ook)sheets)count9: : :)2i.ths9 p_col : :,
p_2i.thI
en.I
##
proce.ure set_colu*n
9 p_col pls_integer
/ p_nu*7*t?. pls_integer :, null
/ p_font?. pls_integer :, null
/ p_fill?. pls_integer :, null
/ p_'or.er?. pls_integer :, null
/ p_align*ent tp_align*ent :, null
/ p_sheet pls_integer :, null
:
is
t_sheet pls_integer :, n1l9 p_sheet/ 2ork'ook)sheets)count9: :I
'egin
2ork'ook)sheets9 t_sheet :)col_f*ts9 p_col :)nu*7*t?. :, p_nu*7*t?.I
2ork'ook)sheets9 t_sheet :)col_f*ts9 p_col :)font?. :, p_font?.I
2ork'ook)sheets9 t_sheet :)col_f*ts9 p_col :)fill?. :, p_fill?.I
2ork'ook)sheets9 t_sheet :)col_f*ts9 p_col :)'or.er?. :, p_'or.er?.I
2ork'ook)sheets9 t_sheet :)col_f*ts9 p_col :)align*ent :, p_align*entI
en.I
##
proce.ure set_ro2
9 p_ro2 pls_integer
/ p_nu*7*t?. pls_integer :, null
/ p_font?. pls_integer :, null
/ p_fill?. pls_integer :, null
/ p_'or.er?. pls_integer :, null
/ p_align*ent tp_align*ent :, null
/ p_sheet pls_integer :, null
:
is
t_sheet pls_integer :, n1l9 p_sheet/ 2ork'ook)sheets)count9: :I
'egin
2ork'ook)sheets9 t_sheet :)ro2_f*ts9 p_ro2 :)nu*7*t?. :, p_nu*7*t?.I
2ork'ook)sheets9 t_sheet :)ro2_f*ts9 p_ro2 :)font?. :, p_font?.I
2ork'ook)sheets9 t_sheet :)ro2_f*ts9 p_ro2 :)fill?. :, p_fill?.I
2ork'ook)sheets9 t_sheet :)ro2_f*ts9 p_ro2 :)'or.er?. :, p_'or.er?.I
2ork'ook)sheets9 t_sheet :)ro2_f*ts9 p_ro2 :)align*ent :, p_align*entI
en.I
##
proce.ure free0e_ro2s
9 p_nr_ro2s pls_integer :, !
/ p_sheet pls_integer :, null
:
is
'egin
2ork'ook)sheets9 n1l9 p_sheet/ 2ork'ook)sheets)count9: : :)free0e_ro2s :, p_nr_ro2sI
en.I
##
proce.ure free0e_cols
9 p_nr_cols pls_integer :, !
/ p_sheet pls_integer :, null
:
is
'egin
2ork'ook)sheets9 n1l9 p_sheet/ 2ork'ook)sheets)count9: : :)free0e_cols :, p_nr_colsI
en.I
##
proce.ure set_autofilter
9 p_colu*n_start pls_integer :, null
/ p_colu*n_en. pls_integer :, null
/ p_ro2_start pls_integer :, null
/ p_ro2_en. pls_integer :, null
/ p_sheet pls_integer :, null
:
is
t_in. pls_integerI
t_sheet pls_integer :, n1l9 p_sheet/ 2ork'ook)sheets)count9: :I
'egin
t_in. :, !I
2ork'ook)sheets9 t_sheet :)autofilters9 t_in. :)colu*n_start :, p_colu*n_startI
2ork'ook)sheets9 t_sheet :)autofilters9 t_in. :)colu*n_en. :, p_colu*n_en.I
2ork'ook)sheets9 t_sheet :)autofilters9 t_in. :)ro2_start :, p_ro2_startI
2ork'ook)sheets9 t_sheet :)autofilters9 t_in. :)ro2_en. :, p_ro2_en.I
.efine._na*e
9 p_colu*n_start
/ p_ro2_start
/ p_colu*n_en.
/ p_ro2_en.
/ 8_xln*)_7ilterata'ase8
/ t_sheet
/ t_sheet # !
:I
en.I
##
/*
proce.ure a..!x*l
9 p_excel in out nocop( 'lo'
/ p_filena*e 1archar%
/ p_x*l clo'
:
is
t_t*p 'lo'I
c_step constant nu*'er :, %<4"3I
'egin
.'*s_lo')createte*porar(9 t_t*p/ true :I
for i in $ )) trunc9 length9 p_x*l : / c_step :
loop
.'*s_lo')appen.9 t_t*p/ utl_i!;n)string_to_ra29 su'str9 p_x*l/ i * c_step L !/
c_step :/ 8AL4%DT7;8 : :I
en. loopI
a..!file9 p_excel/ p_filena*e/ t_t*p :I
.'*s_lo')freete*porar(9 t_t*p :I
en.I
*/
##
proce.ure a..!x*l
9 p_excel in out nocop( 'lo'
/ p_filena*e 1archar%
/ p_x*l clo'
:
is
t_t*p 'lo'I
.est_offset integer :, !I
src_offset integer :, !I
lang_context integerI
2arning integerI
'egin
lang_context :, .'*s_lo')E7ADLT_LA6G_CT=I
.'*s_lo')createte*porar(9 t_t*p/ true :I
.'*s_lo')con1ertto'lo'
9 t_t*p
/ p_x*l
/ .'*s_lo')lo'*axsi0e
/ .est_offset
/ src_offset
/ nls_charset_i.9 8AL4%DT7;8 :
/ lang_context
/ 2arning
:I
a..!file9 p_excel/ p_filena*e/ t_t*p :I
.'*s_lo')freete*porar(9 t_t*p :I
en.I
##
function finish
return 'lo'
is
t_excel 'lo'I
t_xxx clo'I
t_t*p 1archar%94%>3> char:I
t_str 1archar%94%>3> char:I
t_c nu*'erI
t_h nu*'erI
t_2 nu*'erI
t_c2 nu*'erI
t_cell 1archar%9!$$$ char:I
t_ro2_in. pls_integerI
t_col_*in pls_integerI
t_col_*ax pls_integerI
t_col_in. pls_integerI
t_len pls_integerI
ts ti*esta*p :, s(sti*esta*pI
'egin
.'*s_lo')createte*porar(9 t_excel/ true :I
t_xxx :, 8N+x*l 1ersion,@!)$@ enco.ing,@DT7#;@ stan.alone,@(es@+K
NT(pes x*lns,@http://sche*as)openx*lfor*ats)org/package/%$$3/content#t(pes@K
Nefault Extension,@rels@ ContentT(pe,@application/1n.)openx*lfor*ats#
package)relationshipsLx*l@/K
Nefault Extension,@x*l@ ContentT(pe,@application/x*l@/K
Nefault Extension,@1*l@ ContentT(pe,@application/1n.)openx*lfor*ats#
office.ocu*ent)1*lra2ing@/K
NO1erri.e Part6a*e,@/xl/2ork'ook)x*l@
ContentT(pe,@application/1n.)openx*lfor*ats#
office.ocu*ent)sprea.sheet*l)sheet)*ainLx*l@/K8I
for s in ! )) 2ork'ook)sheets)count9:
loop
t_xxx :, t_xxx MM 8
NO1erri.e Part6a*e,@/xl/2orksheets/sheet8 MM s MM 8)x*l@
ContentT(pe,@application/1n.)openx*lfor*ats#
office.ocu*ent)sprea.sheet*l)2orksheetLx*l@/K8I
en. loopI
t_xxx :, t_xxx MM 8
NO1erri.e Part6a*e,@/xl/the*e/the*e!)x*l@
ContentT(pe,@application/1n.)openx*lfor*ats#office.ocu*ent)the*eLx*l@/K
NO1erri.e Part6a*e,@/xl/st(les)x*l@ ContentT(pe,@application/1n.)openx*lfor*ats#
office.ocu*ent)sprea.sheet*l)st(lesLx*l@/K
NO1erri.e Part6a*e,@/xl/share.Strings)x*l@
ContentT(pe,@application/1n.)openx*lfor*ats#
office.ocu*ent)sprea.sheet*l)share.StringsLx*l@/K
NO1erri.e Part6a*e,@/.ocProps/core)x*l@
ContentT(pe,@application/1n.)openx*lfor*ats#package)core#propertiesLx*l@/K
NO1erri.e Part6a*e,@/.ocProps/app)x*l@
ContentT(pe,@application/1n.)openx*lfor*ats#office.ocu*ent)exten.e.#
propertiesLx*l@/K8I
for s in ! )) 2ork'ook)sheets)count9:
loop
if 2ork'ook)sheets9 s :)co**ents)count9: K $
then
t_xxx :, t_xxx MM 8
NO1erri.e Part6a*e,@/xl/co**ents8 MM s MM 8)x*l@
ContentT(pe,@application/1n.)openx*lfor*ats#
office.ocu*ent)sprea.sheet*l)co**entsLx*l@/K8I
en. ifI
en. loopI
t_xxx :, t_xxx MM 8
N/T(pesK8I
a..!x*l9 t_excel/ 8QContent_T(pesR)x*l8/ t_xxx :I
t_xxx :, 8N+x*l 1ersion,@!)$@ enco.ing,@DT7#;@ stan.alone,@(es@+K
Ncp:coreProperties
x*lns:cp,@http://sche*as)openx*lfor*ats)org/package/%$$3/*eta.ata/core#properties@
x*lns:.c,@http://purl)org/.c/ele*ents/!)!/@ x*lns:.cter*s,@http://purl)org/.c/ter*s/@
x*lns:.c*it(pe,@http://purl)org/.c/.c*it(pe/@
x*lns:xsi,@http://222)24)org/%$$!/=5LSche*a#instance@K
N.c:creatorK8 MM s(s_context9 8useren18/ 8os_user8 : MM 8N/.c:creatorK
Ncp:last5o.ifie.H(K8 MM s(s_context9 8useren18/ 8os_user8 : MM 8N/cp:last5o.ifie.H(K
N.cter*s:create. xsi:t(pe,@.cter*s:&4CT7@K8 MM to_char9 current_ti*esta*p/ 8((((#
**#..@T@hh%<:*i:ssTPB:TP58 : MM 8N/.cter*s:create.K
N.cter*s:*o.ifie. xsi:t(pe,@.cter*s:&4CT7@K8 MM to_char9 current_ti*esta*p/ 8((((#
**#..@T@hh%<:*i:ssTPB:TP58 : MM 8N/.cter*s:*o.ifie.K
N/cp:corePropertiesK8I
a..!x*l9 t_excel/ 8.ocProps/core)x*l8/ t_xxx :I
t_xxx :, 8N+x*l 1ersion,@!)$@ enco.ing,@DT7#;@ stan.alone,@(es@+K
NProperties x*lns,@http://sche*as)openx*lfor*ats)org/officeocu*ent/%$$3/exten.e.#
properties@
x*lns:1t,@http://sche*as)openx*lfor*ats)org/officeocu*ent/%$$3/.ocPropsCT(pes@K
NApplicationK5icrosoft ExcelN/ApplicationK
NocSecurit(K$N/ocSecurit(K
NScaleCropKfalseN/ScaleCropK
NBea.ingPairsK
N1t:1ector si0e,@%@ 'aseT(pe,@1ariant@K
N1t:1ariantK
N1t:lpstrK&orksheetsN/1t:lpstrK
N/1t:1ariantK
N1t:1ariantK
N1t:i<K8 MM 2ork'ook)sheets)count9: MM 8N/1t:i<K
N/1t:1ariantK
N/1t:1ectorK
N/Bea.ingPairsK
NTitlesOfPartsK
N1t:1ector si0e,@8 MM 2ork'ook)sheets)count9: MM 8@ 'aseT(pe,@lpstr@K8I
for s in ! )) 2ork'ook)sheets)count9:
loop
t_xxx :, t_xxx MM 8
N1t:lpstrK8 MM 2ork'ook)sheets9 s :)na*e MM 8N/1t:lpstrK8I
en. loopI
t_xxx :, t_xxx MM 8N/1t:1ectorK
N/TitlesOfPartsK
NLinksDpToateKfalseN/LinksDpToateK
NShare.ocKfalseN/Share.ocK
NB(perlinksChange.KfalseN/B(perlinksChange.K
NAppCersionK!<)$4$$N/AppCersionK
N/PropertiesK8I
a..!x*l9 t_excel/ 8.ocProps/app)x*l8/ t_xxx :I
t_xxx :, 8N+x*l 1ersion,@!)$@ enco.ing,@DT7#;@ stan.alone,@(es@+K
NRelationships
x*lns,@http://sche*as)openx*lfor*ats)org/package/%$$3/relationships@K
NRelationship ?.,@r?.4@
T(pe,@http://sche*as)openx*lfor*ats)org/officeocu*ent/%$$3/relationships/exten.e.#
properties@ Target,@.ocProps/app)x*l@/K
NRelationship ?.,@r?.%@
T(pe,@http://sche*as)openx*lfor*ats)org/package/%$$3/relationships/*eta.ata/core#
properties@ Target,@.ocProps/core)x*l@/K
NRelationship ?.,@r?.!@
T(pe,@http://sche*as)openx*lfor*ats)org/officeocu*ent/%$$3/relationships/officeoc
u*ent@ Target,@xl/2ork'ook)x*l@/K
N/RelationshipsK8I
a..!x*l9 t_excel/ 8_rels/)rels8/ t_xxx :I
t_xxx :, 8N+x*l 1ersion,@!)$@ enco.ing,@DT7#;@ stan.alone,@(es@+K
Nst(leSheet x*lns,@http://sche*as)openx*lfor*ats)org/sprea.sheet*l/%$$3/*ain@
x*lns:*c,@http://sche*as)openx*lfor*ats)org/*arkup#co*pati'ilit(/%$$3@
*c:?gnora'le,@x!<ac@
x*lns:x!<ac,@http://sche*as)*icrosoft)co*/office/sprea.sheet*l/%$$"/"/ac@K8I
if 2ork'ook)nu*7*ts)count9: K $
then
t_xxx :, t_xxx MM 8Nnu*7*ts count,@8 MM 2ork'ook)nu*7*ts)count9: MM 8@K8I
for n in ! )) 2ork'ook)nu*7*ts)count9:
loop
t_xxx :, t_xxx MM 8Nnu*7*t nu*7*t?.,@8 MM 2ork'ook)nu*7*ts9 n :)nu*7*t?. MM 8@
for*atCo.e,@8 MM 2ork'ook)nu*7*ts9 n :)for*atCo.e MM 8@/K8I
en. loopI
t_xxx :, t_xxx MM 8N/nu*7*tsK8I
en. ifI
t_xxx :, t_xxx MM 8Nfonts count,@8 MM 2ork'ook)fonts)count9: MM 8@
x!<ac:kno2n7onts,@!@K8I
for f in $ )) 2ork'ook)fonts)count9: # !
loop
t_xxx :, t_xxx MM 8NfontK8 MM
case 2hen 2ork'ook)fonts9 f :)'ol. then 8N'/K8 en. MM
case 2hen 2ork'ook)fonts9 f :)italic then 8Ni/K8 en. MM
case 2hen 2ork'ook)fonts9 f :)un.erline then 8Nu/K8 en. MM
8Ns0 1al,@8 MM to_char9 2ork'ook)fonts9 f :)fontsi0e/ 8T5"8/
86LS_6D5ER?C_CBARACTERS,)/8 : MM 8@/K
Ncolor 8 MM case 2hen 2ork'ook)fonts9 f :)rg' is not null
then 8rg',@8 MM 2ork'ook)fonts9 f :)rg'
else 8the*e,@8 MM 2ork'ook)fonts9 f :)the*e
en. MM 8@/K
Nna*e 1al,@8 MM 2ork'ook)fonts9 f :)na*e MM 8@/K
Nfa*il( 1al,@8 MM 2ork'ook)fonts9 f :)fa*il( MM 8@/K
Nsche*e 1al,@none@/K
N/fontK8I
en. loopI
t_xxx :, t_xxx MM 8N/fontsK
Nfills count,@8 MM 2ork'ook)fills)count9: MM 8@K8I
for f in $ )) 2ork'ook)fills)count9: # !
loop
t_xxx :, t_xxx MM 8NfillKNpattern7ill patternT(pe,@8 MM 2ork'ook)fills9 f :)patternT(pe MM
8@K8 MM
case 2hen 2ork'ook)fills9 f :)fgRGH is not null then 8NfgColor rg',@8 MM
2ork'ook)fills9 f :)fgRGH MM 8@/K8 en. MM
8N/pattern7illKN/fillK8I
en. loopI
t_xxx :, t_xxx MM 8N/fillsK
N'or.ers count,@8 MM 2ork'ook)'or.ers)count9: MM 8@K8I
for ' in $ )) 2ork'ook)'or.ers)count9: # !
loop
t_xxx :, t_xxx MM 8N'or.erK8 MM
case 2hen 2ork'ook)'or.ers9 ' :)left is null then 8Nleft/K8 else 8Nleft st(le,@8 MM
2ork'ook)'or.ers9 ' :)left MM 8@/K8 en. MM
case 2hen 2ork'ook)'or.ers9 ' :)right is null then 8Nright/K8 else 8Nright st(le,@8 MM
2ork'ook)'or.ers9 ' :)right MM 8@/K8 en. MM
case 2hen 2ork'ook)'or.ers9 ' :)top is null then 8Ntop/K8 else 8Ntop st(le,@8 MM
2ork'ook)'or.ers9 ' :)top MM 8@/K8 en. MM
case 2hen 2ork'ook)'or.ers9 ' :)'otto* is null then 8N'otto*/K8 else 8N'otto*
st(le,@8 MM 2ork'ook)'or.ers9 ' :)'otto* MM 8@/K8 en. MM
8N/'or.erK8I
en. loopI
t_xxx :, t_xxx MM 8N/'or.ersK
NcellSt(le=fs count,@!@K
Nxf nu*7*t?.,@$@ font?.,@$@ fill?.,@$@ 'or.er?.,@$@/K
N/cellSt(le=fsK
Ncell=fs count,@8 MM 9 2ork'ook)cell=fs)count9: L ! : MM 8@K
Nxf nu*7*t?.,@$@ font?.,@$@ fill?.,@$@ 'or.er?.,@$@ xf?.,@$@/K8I
for x in ! )) 2ork'ook)cell=fs)count9:
loop
t_xxx :, t_xxx MM 8Nxf nu*7*t?.,@8 MM 2ork'ook)cell=fs9 x :)nu*7*t?. MM 8@ font?.,@8 MM
2ork'ook)cell=fs9 x :)font?. MM 8@ fill?.,@8 MM 2ork'ook)cell=fs9 x :)fill?. MM 8@ 'or.er?.,@8 MM
2ork'ook)cell=fs9 x :)'or.er?. MM 8@K8I
if 9 2ork'ook)cell=fs9 x :)align*ent)hori0ontal is not null
or 2ork'ook)cell=fs9 x :)align*ent)1ertical is not null
or 2ork'ook)cell=fs9 x :)align*ent)2rapText
:
then
t_xxx :, t_xxx MM 8Nalign*ent8 MM
case 2hen 2ork'ook)cell=fs9 x :)align*ent)hori0ontal is not null then 8
hori0ontal,@8 MM 2ork'ook)cell=fs9 x :)align*ent)hori0ontal MM 8@8 en. MM
case 2hen 2ork'ook)cell=fs9 x :)align*ent)1ertical is not null then 8 1ertical,@8 MM
2ork'ook)cell=fs9 x :)align*ent)1ertical MM 8@8 en. MM
case 2hen 2ork'ook)cell=fs9 x :)align*ent)2rapText then 8 2rapText,@true@8 en. MM
8/K8I
en. ifI
t_xxx :, t_xxx MM 8N/xfK8I
en. loopI
t_xxx :, t_xxx MM 8N/cell=fsK
NcellSt(les count,@!@K
NcellSt(le na*e,@6or*al@ xf?.,@$@ 'uiltin?.,@$@/K
N/cellSt(lesK
N.xfs count,@$@/K
Nta'leSt(les count,@$@ .efaultTa'leSt(le,@Ta'leSt(le5e.iu*%@
.efaultPi1otSt(le,@Pi1otSt(leLight!3@/K
NextLstK
Next uri,@VEH>"E7%#;$H;#<4e-#"-H#-<CH7"$%$CW@
x*lns:x!<,@http://sche*as)*icrosoft)co*/office/sprea.sheet*l/%$$"/"/*ain@K
Nx!<:slicerSt(les .efaultSlicerSt(le,@SlicerSt(leLight!@/K
N/extK
N/extLstK
N/st(leSheetK8I
a..!x*l9 t_excel/ 8xl/st(les)x*l8/ t_xxx :I
t_xxx :, 8N+x*l 1ersion,@!)$@ enco.ing,@DT7#;@ stan.alone,@(es@+K
N2ork'ook x*lns,@http://sche*as)openx*lfor*ats)org/sprea.sheet*l/%$$3/*ain@
x*lns:r,@http://sche*as)openx*lfor*ats)org/officeocu*ent/%$$3/relationships@K
NfileCersion app6a*e,@xl@ lastE.ite.,@-@ lo2estE.ite.,@-@ rupHuil.,@"4$%@/K
N2ork'ookPr .ate!"$<,@true@ .efaultThe*eCersion,@!%<%%3@/K
N'ookCie2sK
N2ork'ookCie2 x&in.o2,@!%$@ (&in.o2,@<-@ 2in.o2&i.th,@!"!--@
2in.o2Beight,@<"4-@/K
N/'ookCie2sK
NsheetsK8I
for s in ! )) 2ork'ook)sheets)count9:
loop
t_xxx :, t_xxx MM 8
Nsheet na*e,@8 MM 2ork'ook)sheets9 s :)na*e MM 8@ sheet?.,@8 MM s MM 8@ r:i.,@r?.8 MM 9 " L s : MM
8@/K8I
en. loopI
t_xxx :, t_xxx MM 8N/sheetsK8I
if 2ork'ook).efine._na*es)count9: K $
then
t_xxx :, t_xxx MM 8N.efine.6a*esK8I
for s in ! )) 2ork'ook).efine._na*es)count9:
loop
t_xxx :, t_xxx MM 8
N.efine.6a*e na*e,@8 MM 2ork'ook).efine._na*es9 s :)na*e MM 8@8 MM
case 2hen 2ork'ook).efine._na*es9 s :)sheet is not null then 8 localSheet?.,@8 MM
to_char9 2ork'ook).efine._na*es9 s :)sheet : MM 8@8 en. MM
8K8 MM 2ork'ook).efine._na*es9 s :)ref MM 8N/.efine.6a*eK8I
en. loopI
t_xxx :, t_xxx MM 8N/.efine.6a*esK8I
en. ifI
t_xxx :, t_xxx MM 8NcalcPr calc?.,@!<<-%-@/KN/2ork'ookK8I
a..!x*l9 t_excel/ 8xl/2ork'ook)x*l8/ t_xxx :I
t_xxx :, 8N+x*l 1ersion,@!)$@ enco.ing,@DT7#;@ stan.alone,@(es@+K
Na:the*e x*lns:a,@http://sche*as)openx*lfor*ats)org/.ra2ing*l/%$$3/*ain@
na*e,@Office The*e@K
Na:the*eEle*entsK
Na:clrSche*e na*e,@Office@K
Na:.k!K
Na:s(sClr 1al,@2in.o2Text@ lastClr,@$$$$$$@/K
N/a:.k!K
Na:lt!K
Na:s(sClr 1al,@2in.o2@ lastClr,@777777@/K
N/a:lt!K
Na:.k%K
Na:srg'Clr 1al,@!7<">@/K
N/a:.k%K
Na:lt%K
Na:srg'Clr 1al,@EEECE!@/K
N/a:lt%K
Na:accent!K
Na:srg'Clr 1al,@<7;!H@/K
N/a:accent!K
Na:accent%K
Na:srg'Clr 1al,@C$-$<@/K
N/a:accent%K
Na:accent4K
Na:srg'Clr 1al,@"HHH-"@/K
N/a:accent4K
Na:accent<K
Na:srg'Clr 1al,@;$3<A%@/K
N/a:accent<K
Na:accent-K
Na:srg'Clr 1al,@<HACC3@/K
N/a:accent-K
Na:accent3K
Na:srg'Clr 1al,@7>"3<3@/K
N/a:accent3K
Na:hlinkK
Na:srg'Clr 1al,@$$$$77@/K
N/a:hlinkK
Na:folBlinkK
Na:srg'Clr 1al,@;$$$;$@/K
N/a:folBlinkK
N/a:clrSche*eK
Na:fontSche*e na*e,@Office@K
Na:*aAor7ontK
Na:latin t(peface,@Ca*'ria@/K
Na:ea t(peface,@@/K
Na:cs t(peface,@@/K
Na:font script,@Xpan@ t(peface,@5S P++++@/K
Na:font script,@Bang@ t(peface,@++ ++@/K
Na:font script,@Bans@ t(peface,@++@/K
Na:font script,@Bant@ t(peface,@++++@/K
Na:font script,@Ara'@ t(peface,@Ti*es 6e2 Ro*an@/K
Na:font script,@Be'r@ t(peface,@Ti*es 6e2 Ro*an@/K
Na:font script,@Thai@ t(peface,@Taho*a@/K
Na:font script,@Ethi@ t(peface,@6(ala@/K
Na:font script,@Heng@ t(peface,@Crin.a@/K
Na:font script,@GuAr@ t(peface,@Shruti@/K
Na:font script,@Fh*r@ t(peface,@5oolHoran@/K
Na:font script,@Fn.a@ t(peface,@Tunga@/K
Na:font script,@Guru@ t(peface,@Raa1i@/K
Na:font script,@Cans@ t(peface,@Euphe*ia@/K
Na:font script,@Cher@ t(peface,@Plantagenet Cherokee@/K
Na:font script,@Eiii@ t(peface,@5icrosoft Ei Haiti@/K
Na:font script,@Ti't@ t(peface,@5icrosoft Bi*ala(a@/K
Na:font script,@Thaa@ t(peface,@5C Holi@/K
Na:font script,@e1a@ t(peface,@5angal@/K
Na:font script,@Telu@ t(peface,@Gauta*i@/K
Na:font script,@Ta*l@ t(peface,@Latha@/K
Na:font script,@S(rc@ t(peface,@Estrangelo E.essa@/K
Na:font script,@Or(a@ t(peface,@Falinga@/K
Na:font script,@5l(*@ t(peface,@Fartika@/K
Na:font script,@Laoo@ t(peface,@okCha*pa@/K
Na:font script,@Sinh@ t(peface,@?skoola Pota@/K
Na:font script,@5ong@ t(peface,@5ongolian Haiti@/K
Na:font script,@Ciet@ t(peface,@Ti*es 6e2 Ro*an@/K
Na:font script,@Digh@ t(peface,@5icrosoft Dighur@/K
Na:font script,@Geor@ t(peface,@S(lfaen@/K
N/a:*aAor7ontK
Na:*inor7ontK
Na:latin t(peface,@Cali'ri@/K
Na:ea t(peface,@@/K
Na:cs t(peface,@@/K
Na:font script,@Xpan@ t(peface,@5S P++++@/K
Na:font script,@Bang@ t(peface,@++ ++@/K
Na:font script,@Bans@ t(peface,@++@/K
Na:font script,@Bant@ t(peface,@++++@/K
Na:font script,@Ara'@ t(peface,@Arial@/K
Na:font script,@Be'r@ t(peface,@Arial@/K
Na:font script,@Thai@ t(peface,@Taho*a@/K
Na:font script,@Ethi@ t(peface,@6(ala@/K
Na:font script,@Heng@ t(peface,@Crin.a@/K
Na:font script,@GuAr@ t(peface,@Shruti@/K
Na:font script,@Fh*r@ t(peface,@aunPenh@/K
Na:font script,@Fn.a@ t(peface,@Tunga@/K
Na:font script,@Guru@ t(peface,@Raa1i@/K
Na:font script,@Cans@ t(peface,@Euphe*ia@/K
Na:font script,@Cher@ t(peface,@Plantagenet Cherokee@/K
Na:font script,@Eiii@ t(peface,@5icrosoft Ei Haiti@/K
Na:font script,@Ti't@ t(peface,@5icrosoft Bi*ala(a@/K
Na:font script,@Thaa@ t(peface,@5C Holi@/K
Na:font script,@e1a@ t(peface,@5angal@/K
Na:font script,@Telu@ t(peface,@Gauta*i@/K
Na:font script,@Ta*l@ t(peface,@Latha@/K
Na:font script,@S(rc@ t(peface,@Estrangelo E.essa@/K
Na:font script,@Or(a@ t(peface,@Falinga@/K
Na:font script,@5l(*@ t(peface,@Fartika@/K
Na:font script,@Laoo@ t(peface,@okCha*pa@/K
Na:font script,@Sinh@ t(peface,@?skoola Pota@/K
Na:font script,@5ong@ t(peface,@5ongolian Haiti@/K
Na:font script,@Ciet@ t(peface,@Arial@/K
Na:font script,@Digh@ t(peface,@5icrosoft Dighur@/K
Na:font script,@Geor@ t(peface,@S(lfaen@/K
N/a:*inor7ontK
N/a:fontSche*eK
Na:f*tSche*e na*e,@Office@K
Na:fillSt(leLstK
Na:soli.7illK
Na:sche*eClr 1al,@phClr@/K
N/a:soli.7illK
Na:gra.7ill rot&ithShape,@!@K
Na:gsLstK
Na:gs pos,@$@K
Na:sche*eClr 1al,@phClr@K
Na:tint 1al,@-$$$$@/K
Na:sat5o. 1al,@4$$$$$@/K
N/a:sche*eClrK
N/a:gsK
Na:gs pos,@4-$$$@K
Na:sche*eClr 1al,@phClr@K
Na:tint 1al,@4>$$$@/K
Na:sat5o. 1al,@4$$$$$@/K
N/a:sche*eClrK
N/a:gsK
Na:gs pos,@!$$$$$@K
Na:sche*eClr 1al,@phClr@K
Na:tint 1al,@!-$$$@/K
Na:sat5o. 1al,@4-$$$$@/K
N/a:sche*eClrK
N/a:gsK
N/a:gsLstK
Na:lin ang,@!3%$$$$$@ scale.,@!@/K
N/a:gra.7illK
Na:gra.7ill rot&ithShape,@!@K
Na:gsLstK
Na:gs pos,@$@K
Na:sche*eClr 1al,@phClr@K
Na:sha.e 1al,@-!$$$@/K
Na:sat5o. 1al,@!4$$$$@/K
N/a:sche*eClrK
N/a:gsK
Na:gs pos,@;$$$$@K
Na:sche*eClr 1al,@phClr@K
Na:sha.e 1al,@"4$$$@/K
Na:sat5o. 1al,@!4$$$$@/K
N/a:sche*eClrK
N/a:gsK
Na:gs pos,@!$$$$$@K
Na:sche*eClr 1al,@phClr@K
Na:sha.e 1al,@"<$$$@/K
Na:sat5o. 1al,@!4-$$$@/K
N/a:sche*eClrK
N/a:gsK
N/a:gsLstK
Na:lin ang,@!3%$$$$$@ scale.,@$@/K
N/a:gra.7illK
N/a:fillSt(leLstK
Na:lnSt(leLstK
Na:ln 2,@"-%-@ cap,@flat@ c*p.,@sng@ algn,@ctr@K
Na:soli.7illK
Na:sche*eClr 1al,@phClr@K
Na:sha.e 1al,@"-$$$@/K
Na:sat5o. 1al,@!$-$$$@/K
N/a:sche*eClrK
N/a:soli.7illK
Na:prstash 1al,@soli.@/K
N/a:lnK
Na:ln 2,@%-<$$@ cap,@flat@ c*p.,@sng@ algn,@ctr@K
Na:soli.7illK
Na:sche*eClr 1al,@phClr@/K
N/a:soli.7illK
Na:prstash 1al,@soli.@/K
N/a:lnK
Na:ln 2,@4;!$$@ cap,@flat@ c*p.,@sng@ algn,@ctr@K
Na:soli.7illK
Na:sche*eClr 1al,@phClr@/K
N/a:soli.7illK
Na:prstash 1al,@soli.@/K
N/a:lnK
N/a:lnSt(leLstK
Na:effectSt(leLstK
Na:effectSt(leK
Na:effectLstK
Na:outerSh.2 'lurRa.,@<$$$$@ .ist,@%$$$$@ .ir,@-<$$$$$@ rot&ithShape,@$@K
Na:srg'Clr 1al,@$$$$$$@K
Na:alpha 1al,@4;$$$@/K
N/a:srg'ClrK
N/a:outerSh.2K
N/a:effectLstK
N/a:effectSt(leK
Na:effectSt(leK
Na:effectLstK
Na:outerSh.2 'lurRa.,@<$$$$@ .ist,@%4$$$@ .ir,@-<$$$$$@ rot&ithShape,@$@K
Na:srg'Clr 1al,@$$$$$$@K
Na:alpha 1al,@4-$$$@/K
N/a:srg'ClrK
N/a:outerSh.2K
N/a:effectLstK
N/a:effectSt(leK
Na:effectSt(leK
Na:effectLstK
Na:outerSh.2 'lurRa.,@<$$$$@ .ist,@%4$$$@ .ir,@-<$$$$$@ rot&ithShape,@$@K
Na:srg'Clr 1al,@$$$$$$@K
Na:alpha 1al,@4-$$$@/K
N/a:srg'ClrK
N/a:outerSh.2K
N/a:effectLstK
Na:scene4.K
Na:ca*era prst,@orthographic7ront@K
Na:rot lat,@$@ lon,@$@ re1,@$@/K
N/a:ca*eraK
Na:lightRig rig,@threePt@ .ir,@t@K
Na:rot lat,@$@ lon,@$@ re1,@!%$$$$$@/K
N/a:lightRigK
N/a:scene4.K
Na:sp4.K
Na:'e1elT 2,@34-$$@ h,@%-<$$@/K
N/a:sp4.K
N/a:effectSt(leK
N/a:effectSt(leLstK
Na:'g7illSt(leLstK
Na:soli.7illK
Na:sche*eClr 1al,@phClr@/K
N/a:soli.7illK
Na:gra.7ill rot&ithShape,@!@K
Na:gsLstK
Na:gs pos,@$@K
Na:sche*eClr 1al,@phClr@K
Na:tint 1al,@<$$$$@/K
Na:sat5o. 1al,@4-$$$$@/K
N/a:sche*eClrK
N/a:gsK
Na:gs pos,@<$$$$@K
Na:sche*eClr 1al,@phClr@K
Na:tint 1al,@<-$$$@/K
Na:sha.e 1al,@""$$$@/K
Na:sat5o. 1al,@4-$$$$@/K
N/a:sche*eClrK
N/a:gsK
Na:gs pos,@!$$$$$@K
Na:sche*eClr 1al,@phClr@K
Na:sha.e 1al,@%$$$$@/K
Na:sat5o. 1al,@%--$$$@/K
N/a:sche*eClrK
N/a:gsK
N/a:gsLstK
Na:path path,@circle@K
Na:fillToRect l,@-$$$$@ t,@#;$$$$@ r,@-$$$$@ ',@!;$$$$@/K
N/a:pathK
N/a:gra.7illK
Na:gra.7ill rot&ithShape,@!@K
Na:gsLstK
Na:gs pos,@$@K
Na:sche*eClr 1al,@phClr@K
Na:tint 1al,@;$$$$@/K
Na:sat5o. 1al,@4$$$$$@/K
N/a:sche*eClrK
N/a:gsK
Na:gs pos,@!$$$$$@K
Na:sche*eClr 1al,@phClr@K
Na:sha.e 1al,@4$$$$@/K
Na:sat5o. 1al,@%$$$$$@/K
N/a:sche*eClrK
N/a:gsK
N/a:gsLstK
Na:path path,@circle@K
Na:fillToRect l,@-$$$$@ t,@-$$$$@ r,@-$$$$@ ',@-$$$$@/K
N/a:pathK
N/a:gra.7illK
N/a:'g7illSt(leLstK
N/a:f*tSche*eK
N/a:the*eEle*entsK
Na:o'Aectefaults/K
Na:extraClrSche*eLst/K
N/a:the*eK8I
a..!x*l9 t_excel/ 8xl/the*e/the*e!)x*l8/ t_xxx :I
for s in ! )) 2ork'ook)sheets)count9:
loop
t_col_*in :, !34;<I
t_col_*ax :, !I
t_ro2_in. :, 2ork'ook)sheets9 s :)ro2s)first9:I
2hile t_ro2_in. is not null
loop
t_col_*in :, least9 t_col_*in/ 2ork'ook)sheets9 s :)ro2s9 t_ro2_in. :)first9: :I
t_col_*ax :, greatest9 t_col_*ax/ 2ork'ook)sheets9 s :)ro2s9 t_ro2_in. :)last9: :I
t_ro2_in. :, 2ork'ook)sheets9 s :)ro2s)next9 t_ro2_in. :I
en. loopI
t_xxx :, 8N+x*l 1ersion,@!)$@ enco.ing,@DT7#;@ stan.alone,@(es@+K
N2orksheet x*lns,@http://sche*as)openx*lfor*ats)org/sprea.sheet*l/%$$3/*ain@
x*lns:r,@http://sche*as)openx*lfor*ats)org/officeocu*ent/%$$3/relationships@
x*lns:x.r,@http://sche*as)openx*lfor*ats)org/.ra2ing*l/%$$3/sprea.sheetra2ing@
x*lns:x!<,@http://sche*as)*icrosoft)co*/office/sprea.sheet*l/%$$"/"/*ain@
x*lns:*c,@http://sche*as)openx*lfor*ats)org/*arkup#co*pati'ilit(/%$$3@
*c:?gnora'le,@x!<ac@
x*lns:x!<ac,@http://sche*as)*icrosoft)co*/office/sprea.sheet*l/%$$"/"/ac@K
N.i*ension ref,@8 MM alfan_col9 t_col_*in : MM 2ork'ook)sheets9 s :)ro2s)first9: MM 8:8 MM
alfan_col9 t_col_*ax : MM 2ork'ook)sheets9 s :)ro2s)last9: MM 8@/K
NsheetCie2sK
NsheetCie28 MM case 2hen s , ! then 8 ta'Selecte.,@!@8 en. MM 8 2ork'ookCie2?.,@$@K8I
if 2ork'ook)sheets9 s :)free0e_ro2s K $
then
t_xxx :, t_xxx MM 8Npane (Split,@8 MM 2ork'ook)sheets9 s :)free0e_ro2s MM 8@
topLeftCell,@A8 MM 9 2ork'ook)sheets9 s :)free0e_ro2s L ! : MM 8@ acti1ePane,@'otto*Left@
state,@fro0en@/K8I
en. ifI
if 2ork'ook)sheets9 s :)free0e_cols K $
then
t_xxx :, t_xxx MM 8Npane xSplit,@8 MM 2ork'ook)sheets9 s :)free0e_cols MM 8@
topLeftCell,@8 MM alfan_col9 2ork'ook)sheets9 s :)free0e_cols L ! : MM 8!@
acti1ePane,@'otto*Left@ state,@fro0en@/K8I
en. ifI
t_xxx :, t_xxx MM 8N/sheetCie2K
N/sheetCie2sK
Nsheet7or*atPr .efaultRo2Beight,@!-@ x!<ac:.(escent,@$)%-@/K8I
if 2ork'ook)sheets9 s :)2i.ths)count9: K $
then
t_xxx :, t_xxx MM 8NcolsK8I
t_col_in. :, 2ork'ook)sheets9 s :)2i.ths)first9:I
2hile t_col_in. is not null
loop
t_xxx :, t_xxx MM
8Ncol *in,@8 MM t_col_in. MM 8@ *ax,@8 MM t_col_in. MM 8@ 2i.th,@8 MM
to_char9 2ork'ook)sheets9 s :)2i.ths9 t_col_in. :/ 8T5"8/
86LS_6D5ER?C_CBARACTERS,)/8 : MM 8@ custo*&i.th,@!@/K8I
t_col_in. :, 2ork'ook)sheets9 s :)2i.ths)next9 t_col_in. :I
en. loopI
t_xxx :, t_xxx MM 8N/colsK8I
en. ifI
t_xxx :, t_xxx MM 8NsheetataK8I
t_ro2_in. :, 2ork'ook)sheets9 s :)ro2s)first9:I
t_t*p :, nullI
2hile t_ro2_in. is not null
loop
t_t*p :, t_t*p MM 8Nro2 r,@8 MM t_ro2_in. MM 8@ spans,@8 MM t_col_*in MM 8:8 MM t_col_*ax MM
8@K8I
t_len :, length9 t_t*p :I
t_col_in. :, 2ork'ook)sheets9 s :)ro2s9 t_ro2_in. :)first9:I
2hile t_col_in. is not null
loop
t_cell :, 8Nc r,@8 MM alfan_col9 t_col_in. : MM t_ro2_in. MM 8@8
MM 8 8 MM 2ork'ook)sheets9 s :)ro2s9 t_ro2_in. :9 t_col_in. :)st(le
MM 8KN1K8
MM to_char9 2ork'ook)sheets9 s :)ro2s9 t_ro2_in. :9 t_col_in. :)1alue/ 8T5"8/
86LS_6D5ER?C_CBARACTERS,)/8 :
MM 8N/1KN/cK8I
if t_len K 4%$$$
then
.'*s_lo')2riteappen.9 t_xxx/ t_len/ t_t*p :I
t_t*p :, nullI
t_len :, $I
en. ifI
t_t*p :, t_t*p MM t_cellI
t_len :, t_len L length9 t_cell :I
t_col_in. :, 2ork'ook)sheets9 s :)ro2s9 t_ro2_in. :)next9 t_col_in. :I
en. loopI
t_t*p :, t_t*p MM 8N/ro2K8I
t_ro2_in. :, 2ork'ook)sheets9 s :)ro2s)next9 t_ro2_in. :I
en. loopI
t_t*p :, t_t*p MM 8N/sheetataK8I
t_len :, length9 t_t*p :I
.'*s_lo')2riteappen.9 t_xxx/ t_len/ t_t*p :I
for a in ! )) 2ork'ook)sheets9 s :)autofilters)count9:
loop
t_xxx :, t_xxx MM 8Nauto7ilter ref,@8 MM
alfan_col9 n1l9 2ork'ook)sheets9 s :)autofilters9 a :)colu*n_start/ t_col_*in : : MM
n1l9 2ork'ook)sheets9 s :)autofilters9 a :)ro2_start/
2ork'ook)sheets9 s :)ro2s)first9: : MM 8:8 MM
alfan_col9 coalesce9 2ork'ook)sheets9 s :)autofilters9 a :)colu*n_en./
2ork'ook)sheets9 s :)autofilters9 a :)colu*n_start/ t_col_*ax : : MM
n1l9 2ork'ook)sheets9 s :)autofilters9 a :)ro2_en./
2ork'ook)sheets9 s :)ro2s)last9: : MM 8@/K8I
en. loopI
if 2ork'ook)sheets9 s :)*ergecells)count9: K $
then
t_xxx :, t_xxx MM 8N*ergeCells count,@8 MM
to_char9 2ork'ook)sheets9 s :)*ergecells)count9: : MM 8@K8I
for * in ! )) 2ork'ook)sheets9 s :)*ergecells)count9:
loop
t_xxx :, t_xxx MM 8N*ergeCell ref,@8 MM 2ork'ook)sheets9 s :)*ergecells9 * : MM 8@/K8I
en. loopI
t_xxx :, t_xxx MM 8N/*ergeCellsK8I
en. ifI
##
if 2ork'ook)sheets9 s :)1ali.ations)count9: K $
then
t_xxx :, t_xxx MM 8N.ataCali.ations count,@8 MM
to_char9 2ork'ook)sheets9 s :)1ali.ations)count9: : MM 8@K8I
for * in ! )) 2ork'ook)sheets9 s :)1ali.ations)count9:
loop
t_xxx :, t_xxx MM 8N.ataCali.ation8 MM
8 t(pe,@8 MM 2ork'ook)sheets9 s :)1ali.ations9 * :)t(pe MM 8@8 MM
8 errorSt(le,@8 MM 2ork'ook)sheets9 s :)1ali.ations9 * :)errorst(le MM 8@8 MM
8 allo2Hlank,@8 MM case 2hen
n1l9 2ork'ook)sheets9 s :)1ali.ations9 * :)allo2Hlank/ true : then 8!8 else 8$8 en. MM 8@8 MM
8 sJref,@8 MM 2ork'ook)sheets9 s :)1ali.ations9 * :)sJref MM 8@8I
if 2ork'ook)sheets9 s :)1ali.ations9 * :)pro*pt is not null
then
t_xxx :, t_xxx MM 8 sho2?nput5essage,@!@ pro*pt,@8 MM
2ork'ook)sheets9 s :)1ali.ations9 * :)pro*pt MM 8@8I
if 2ork'ook)sheets9 s :)1ali.ations9 * :)title is not null
then
t_xxx :, t_xxx MM 8 pro*ptTitle,@8 MM 2ork'ook)sheets9 s :)1ali.ations9 * :)title MM
8@8I
en. ifI
en. ifI
if 2ork'ook)sheets9 s :)1ali.ations9 * :)sho2error*essage
then
t_xxx :, t_xxx MM 8 sho2Error5essage,@!@8I
if 2ork'ook)sheets9 s :)1ali.ations9 * :)error_title is not null
then
t_xxx :, t_xxx MM 8 errorTitle,@8 MM 2ork'ook)sheets9 s :)1ali.ations9 * :)error_title
MM 8@8I
en. ifI
if 2ork'ook)sheets9 s :)1ali.ations9 * :)error_txt is not null
then
t_xxx :, t_xxx MM 8 error,@8 MM 2ork'ook)sheets9 s :)1ali.ations9 * :)error_txt MM 8@8I
en. ifI
en. ifI
t_xxx :, t_xxx MM 8K8I
if 2ork'ook)sheets9 s :)1ali.ations9 * :)for*ula! is not null
then
t_xxx :, t_xxx MM 8Nfor*ula!K8 MM 2ork'ook)sheets9 s :)1ali.ations9 * :)for*ula! MM
8N/for*ula!K8I
en. ifI
if 2ork'ook)sheets9 s :)1ali.ations9 * :)for*ula% is not null
then
t_xxx :, t_xxx MM 8Nfor*ula%K8 MM 2ork'ook)sheets9 s :)1ali.ations9 * :)for*ula% MM
8N/for*ula%K8I
en. ifI
t_xxx :, t_xxx MM 8N/.ataCali.ationK8I
en. loopI
t_xxx :, t_xxx MM 8N/.ataCali.ationsK8I
en. ifI
##
if 2ork'ook)sheets9 s :)h(perlinks)count9: K $
then
t_xxx :, t_xxx MM 8Nh(perlinksK8I
for h in ! )) 2ork'ook)sheets9 s :)h(perlinks)count9:
loop
t_xxx :, t_xxx MM 8Nh(perlink ref,@8 MM 2ork'ook)sheets9 s :)h(perlinks9 h :)cell MM 8@
r:i.,@r?.8 MM h MM 8@/K8I
en. loopI
t_xxx :, t_xxx MM 8N/h(perlinksK8I
en. ifI
t_xxx :, t_xxx MM 8Npage5argins left,@$)>@ right,@$)>@ top,@$)>-@ 'otto*,@$)>-@
hea.er,@$)4@ footer,@$)4@/K8I
if 2ork'ook)sheets9 s :)co**ents)count9: K $
then
t_xxx :, t_xxx MM 8Nlegac(ra2ing r:i.,@r?.8 MM
9 2ork'ook)sheets9 s :)h(perlinks)count9: L ! : MM 8@/K8I
en. ifI
##
t_xxx :, t_xxx MM 8N/2orksheetK8I
a..!x*l9 t_excel/ 8xl/2orksheets/sheet8 MM s MM 8)x*l8/ t_xxx :I
if 2ork'ook)sheets9 s :)h(perlinks)count9: K $ or
2ork'ook)sheets9 s :)co**ents)count9: K $
then
t_xxx :, 8N+x*l 1ersion,@!)$@ enco.ing,@DT7#;@ stan.alone,@(es@+K
NRelationships
x*lns,@http://sche*as)openx*lfor*ats)org/package/%$$3/relationships@K8I
if 2ork'ook)sheets9 s :)co**ents)count9: K $
then
t_xxx :, t_xxx MM 8NRelationship ?.,@r?.8 MM 9 2ork'ook)sheets9 s :)h(perlinks)count9:
L % : MM 8@
T(pe,@http://sche*as)openx*lfor*ats)org/officeocu*ent/%$$3/relationships/co**ents
@ Target,@))/co**ents8 MM s MM 8)x*l@/K8I
t_xxx :, t_xxx MM 8NRelationship ?.,@r?.8 MM 9 2ork'ook)sheets9 s :)h(perlinks)count9:
L ! : MM 8@
T(pe,@http://sche*as)openx*lfor*ats)org/officeocu*ent/%$$3/relationships/1*lra2i
ng@ Target,@))/.ra2ings/1*lra2ing8 MM s MM 8)1*l@/K8I
en. ifI
for h in ! )) 2ork'ook)sheets9 s :)h(perlinks)count9:
loop
t_xxx :, t_xxx MM 8NRelationship ?.,@r?.8 MM h MM 8@
T(pe,@http://sche*as)openx*lfor*ats)org/officeocu*ent/%$$3/relationships/h(perlink
@ Target,@8 MM 2ork'ook)sheets9 s :)h(perlinks9 h :)url MM 8@ Target5o.e,@External@/K8I
en. loopI
t_xxx :, t_xxx MM 8N/RelationshipsK8I
a..!x*l9 t_excel/ 8xl/2orksheets/_rels/sheet8 MM s MM 8)x*l)rels8/ t_xxx :I
en. ifI
##
if 2ork'ook)sheets9 s :)co**ents)count9: K $
then
.eclare
cnt pls_integerI
author_in. tp_authorI
## t_col_in. :, 2ork'ook)sheets9 s :)2i.ths)next9 t_col_in. :I
'egin
authors).elete9:I
for c in ! )) 2ork'ook)sheets9 s :)co**ents)count9:
loop
authors9 2ork'ook)sheets9 s :)co**ents9 c :)author : :, $I
en. loopI
t_xxx :, 8N+x*l 1ersion,@!)$@ enco.ing,@DT7#;@ stan.alone,@(es@+K
Nco**ents x*lns,@http://sche*as)openx*lfor*ats)org/sprea.sheet*l/%$$3/*ain@K
NauthorsK8I
cnt :, $I
author_in. :, authors)first9:I
2hile author_in. is not null or authors)next9 author_in. : is not null
loop
authors9 author_in. : :, cntI
t_xxx :, t_xxx MM 8NauthorK8 MM author_in. MM 8N/authorK8I
cnt :, cnt L !I
author_in. :, authors)next9 author_in. :I
en. loopI
en.I
t_xxx :, t_xxx MM 8N/authorsKNco**entListK8I
for c in ! )) 2ork'ook)sheets9 s :)co**ents)count9:
loop
t_xxx :, t_xxx MM 8Nco**ent ref,@8 MM
alfan_col9 2ork'ook)sheets9 s :)co**ents9 c :)colu*n : MM
to_char9 2ork'ook)sheets9 s :)co**ents9 c :)ro2 MM 8@ author?.,@8 MM
authors9 2ork'ook)sheets9 s :)co**ents9 c :)author : : MM 8@K
NtextK8I
if 2ork'ook)sheets9 s :)co**ents9 c :)author is not null
then
t_xxx :, t_xxx MM 8NrKNrPrKN'/KNs0 1al,@"@/KNcolor in.exe.,@;!@/KNr7ont
1al,@Taho*a@/KNcharset 1al,@!@/KN/rPrKNt x*l:space,@preser1e@K8 MM
2ork'ook)sheets9 s :)co**ents9 c :)author MM 8:N/tKN/rK8I
en. ifI
t_xxx :, t_xxx MM 8NrKNrPrKNs0 1al,@"@/KNcolor in.exe.,@;!@/KNr7ont
1al,@Taho*a@/KNcharset 1al,@!@/KN/rPrKNt x*l:space,@preser1e@K8 MM
case 2hen 2ork'ook)sheets9 s :)co**ents9 c :)author is not null then 8
8 en. MM 2ork'ook)sheets9 s :)co**ents9 c :)text MM 8N/tKN/rKN/textKN/co**entK8I
en. loopI
t_xxx :, t_xxx MM 8N/co**entListKN/co**entsK8I
a..!x*l9 t_excel/ 8xl/co**ents8 MM s MM 8)x*l8/ t_xxx :I
t_xxx :, 8Nx*l x*lns:1,@urn:sche*as#*icrosoft#co*:1*l@ x*lns:o,@urn:sche*as#
*icrosoft#co*:office:office@ x*lns:x,@urn:sche*as#*icrosoft#co*:office:excel@K
No:shapela(out 1:ext,@e.it@KNo:i.*ap 1:ext,@e.it@ .ata,@%@/KN/o:shapela(outK
N1:shapet(pe i.,@_x$$$$_t%$%@ coor.si0e,@%!3$$/%!3$$@ o:spt,@%$%@
path,@*/l/%!3$$r%!3$$/l%!3$$/xe@KN1:stroke Aoinst(le,@*iter@/KN1:path
gra.ientshapeok,@t@ o:connectt(pe,@rect@/KN/1:shapet(peK8I
for c in ! )) 2ork'ook)sheets9 s :)co**ents)count9:
loop
t_xxx :, t_xxx MM 8N1:shape i.,@_x$$$$_s8 MM to_char9 c : MM 8@ t(pe,@Y_x$$$$_t%$%@
st(le,@position:a'soluteI*argin#left:4-)%-ptI*argin#top:4ptI0#in.ex:8 MM to_char9 c : MM
8I1isi'ilit(:hi..enI@ fillcolor,@Yffffe!@ o:inset*o.e,@auto@K
N1:fill color%,@Yffffe!@/KN1:sha.o2 on,@t@ color,@'lack@ o'scure.,@t@/KN1:path
o:connectt(pe,@none@/K
N1:text'ox st(le,@*so#.irection#alt:auto@KN.i1 st(le,@text#
align:left@KN/.i1KN/1:text'oxK
Nx:Clientata O'AectT(pe,@6ote@KNx:5o1e&ithCells/KNx:Si0e&ithCells/K8I
t_2 :, 2ork'ook)sheets9 s :)co**ents9 c :)2i.thI
t_c :, !I
loop
if 2ork'ook)sheets9 s :)2i.ths)exists9 2ork'ook)sheets9 s :)co**ents9 c :)colu*n
L t_c :
then
t_c2 :, %-3 *
2ork'ook)sheets9 s :)2i.ths9 2ork'ook)sheets9 s :)co**ents9 c :)colu*n L t_c :I
t_c2 :, trunc9 9 t_c2 L !; : / %-3 * >:I ## assu*e .efault !! point Cali'ri
else
t_c2 :, 3<I
en. ifI
exit 2hen t_2 N t_c2I
t_c :, t_c L !I
t_2 :, t_2 # t_c2I
en. loopI
t_h :, 2ork'ook)sheets9 s :)co**ents9 c :)heightI
t_xxx :, t_xxx MM to_char9 8Nx:AnchorK8 MM
2ork'ook)sheets9 s :)co**ents9 c :)colu*n MM 8/!-/8 MM
2ork'ook)sheets9 s :)co**ents9 c :)ro2 MM 8/4$/8 MM
9 2ork'ook)sheets9 s :)co**ents9 c :)colu*n L t_c # ! : MM 8/8 MM roun.9 t_2 : MM
8/8 MM
9 2ork'ook)sheets9 s :)co**ents9 c :)ro2 L ! L trunc9 t_h / %$ : : MM 8/8 MM *o.9
t_h/ %$ : MM 8N/x:AnchorK8 :I
t_xxx :, t_xxx MM to_char9 8Nx:Auto7illK7alseN/x:Auto7illKNx:Ro2K8 MM
9 2ork'ook)sheets9 s :)co**ents9 c :)ro2 # ! : MM 8N/x:Ro2KNx:Colu*nK8 MM
9 2ork'ook)sheets9 s :)co**ents9 c :)colu*n # ! : MM
8N/x:Colu*nKN/x:ClientataKN/1:shapeK8 :I
en. loopI
t_xxx :, t_xxx MM 8N/x*lK8I
a..!x*l9 t_excel/ 8xl/.ra2ings/1*lra2ing8 MM s MM 8)1*l8/ t_xxx :I
en. ifI
##
en. loopI
t_xxx :, 8N+x*l 1ersion,@!)$@ enco.ing,@DT7#;@ stan.alone,@(es@+K
NRelationships
x*lns,@http://sche*as)openx*lfor*ats)org/package/%$$3/relationships@K
NRelationship ?.,@r?.!@
T(pe,@http://sche*as)openx*lfor*ats)org/officeocu*ent/%$$3/relationships/share.Stri
ngs@ Target,@share.Strings)x*l@/K
NRelationship ?.,@r?.%@
T(pe,@http://sche*as)openx*lfor*ats)org/officeocu*ent/%$$3/relationships/st(les@
Target,@st(les)x*l@/K
NRelationship ?.,@r?.4@
T(pe,@http://sche*as)openx*lfor*ats)org/officeocu*ent/%$$3/relationships/the*e@
Target,@the*e/the*e!)x*l@/K8I
for s in ! )) 2ork'ook)sheets)count9:
loop
t_xxx :, t_xxx MM 8
NRelationship ?.,@r?.8 MM 9 " L s : MM 8@
T(pe,@http://sche*as)openx*lfor*ats)org/officeocu*ent/%$$3/relationships/2orksheet
@ Target,@2orksheets/sheet8 MM s MM 8)x*l@/K8I
en. loopI
t_xxx :, t_xxx MM 8N/RelationshipsK8I
a..!x*l9 t_excel/ 8xl/_rels/2ork'ook)x*l)rels8/ t_xxx :I
t_xxx :, 8N+x*l 1ersion,@!)$@ enco.ing,@DT7#;@ stan.alone,@(es@+K
Nsst x*lns,@http://sche*as)openx*lfor*ats)org/sprea.sheet*l/%$$3/*ain@ count,@8 MM
2ork'ook)str_cnt MM 8@ uniJueCount,@8 MM 2ork'ook)strings)count9: MM 8@K8I
t_t*p :, nullI
for i in $ )) 2ork'ook)str_in.)count9: # !
loop
t_str :, 8NsiKNtK8 MM .'*s_x*lgen)con1ert9 su'str9 2ork'ook)str_in.9 i :/ !/ 4%$$$ : : MM
8N/tKN/siK8I
if length9 t_t*p : L length9 t_str : K 4%$$$
then
t_xxx :, t_xxx MM t_t*pI
t_t*p :, nullI
en. ifI
t_t*p :, t_t*p MM t_strI
en. loopI
t_xxx :, t_xxx MM t_t*p MM 8N/sstK8I
a..!x*l9 t_excel/ 8xl/share.Strings)x*l8/ t_xxx :I
finish_0ip9 t_excel :I
clear_2ork'ookI
return t_excelI
en.I
##
proce.ure sa1e
9 p_.irector( 1archar%
/ p_filena*e 1archar%
:
is
'egin
'lo'%file9 finish/ p_.irector(/ p_filena*e :I
en.I
##
proce.ure Juer(%sheet
9 p_sJl 1archar%
/ p_colu*n_hea.ers 'oolean :, true
/ p_.irector( 1archar% :, null
/ p_filena*e 1archar% :, null
/ p_sheet pls_integer :, null
:
is
t_sheet pls_integerI
t_c integerI
t_col_cnt integerI
t_.esc_ta' .'*s_sJl).esc_ta'%I
._ta' .'*s_sJl).ate_ta'leI
n_ta' .'*s_sJl)nu*'er_ta'leI
1_ta' .'*s_sJl)1archar%_ta'leI
t_'ulk_si0e pls_integer :, %$$I
t_r integerI
t_cur_ro2 pls_integerI
'egin
if p_sheet is null
then
ne2_sheetI
en. ifI
t_c :, .'*s_sJl)open_cursorI
.'*s_sJl)parse9 t_c/ p_sJl/ .'*s_sJl)nati1e :I
.'*s_sJl).escri'e_colu*ns%9 t_c/ t_col_cnt/ t_.esc_ta' :I
for c in ! )) t_col_cnt
loop
if p_colu*n_hea.ers
then
cell9 c/ !/ t_.esc_ta'9 c :)col_na*e/ p_sheet ,K t_sheet :I
en. ifI
## .'*s_output)put_line9 t_.esc_ta'9 c :)col_na*e MM 8 8 MM t_.esc_ta'9 c :)col_t(pe :I
case
2hen t_.esc_ta'9 c :)col_t(pe in 9 %/ !$$/ !$! :
then
.'*s_sJl).efine_arra(9 t_c/ c/ n_ta'/ t_'ulk_si0e/ ! :I
2hen t_.esc_ta'9 c :)col_t(pe in 9 !%/ !>;/ !>"/ !;$/ !;! / %4! :
then
.'*s_sJl).efine_arra(9 t_c/ c/ ._ta'/ t_'ulk_si0e/ ! :I
2hen t_.esc_ta'9 c :)col_t(pe in 9 !/ ;/ "/ "3/ !!% :
then
.'*s_sJl).efine_arra(9 t_c/ c/ 1_ta'/ t_'ulk_si0e/ ! :I
else
nullI
en. caseI
en. loopI
##
t_cur_ro2 :, case 2hen p_colu*n_hea.ers then % else ! en.I
t_sheet :, n1l9 p_sheet/ 2ork'ook)sheets)count9: :I
##
t_r :, .'*s_sJl)execute9 t_c :I
loop
t_r :, .'*s_sJl)fetch_ro2s9 t_c :I
if t_r K $
then
for c in ! )) t_col_cnt
loop
case
2hen t_.esc_ta'9 c :)col_t(pe in 9 %/ !$$/ !$! :
then
.'*s_sJl)colu*n_1alue9 t_c/ c/ n_ta' :I
for i in $ )) t_r # !
loop
if n_ta'9 i L n_ta')first9: : is not null
then
cell9 c/ t_cur_ro2 L i/ n_ta'9 i L n_ta')first9: :/ p_sheet ,K t_sheet :I
en. ifI
en. loopI
n_ta').eleteI
2hen t_.esc_ta'9 c :)col_t(pe in 9 !%/ !>;/ !>"/ !;$/ !;! / %4! :
then
.'*s_sJl)colu*n_1alue9 t_c/ c/ ._ta' :I
for i in $ )) t_r # !
loop
if ._ta'9 i L ._ta')first9: : is not null
then
cell9 c/ t_cur_ro2 L i/ ._ta'9 i L ._ta')first9: :/ p_sheet ,K t_sheet :I
en. ifI
en. loopI
._ta').eleteI
2hen t_.esc_ta'9 c :)col_t(pe in 9 !/ ;/ "/ "3/ !!% :
then
.'*s_sJl)colu*n_1alue9 t_c/ c/ 1_ta' :I
for i in $ )) t_r # !
loop
if 1_ta'9 i L 1_ta')first9: : is not null
then
cell9 c/ t_cur_ro2 L i/ 1_ta'9 i L 1_ta')first9: :/ p_sheet ,K t_sheet :I
en. ifI
en. loopI
1_ta').eleteI
else
nullI
en. caseI
en. loopI
en. ifI
exit 2hen t_r U, t_'ulk_si0eI
t_cur_ro2 :, t_cur_ro2 L t_rI
en. loopI
.'*s_sJl)close_cursor9 t_c :I
if 9 p_.irector( is not null an. p_filena*e is not null :
then
sa1e9 p_.irector(/ p_filena*e :I
en. ifI
exception
2hen others
then
if .'*s_sJl)is_open9 t_c :
then
.'*s_sJl)close_cursor9 t_c :I
en. ifI
en.I
en.I
/

Вам также может понравиться