Skip to content

Commit

Permalink
Fix issue 57, put clean_string back
Browse files Browse the repository at this point in the history
  • Loading branch information
eaolson committed Oct 7, 2018
1 parent c121c58 commit 9680b0e
Showing 1 changed file with 43 additions and 12 deletions.
55 changes: 43 additions & 12 deletions ora/xlsx_builder_pkg.pkb
Original file line number Diff line number Diff line change
Expand Up @@ -664,9 +664,15 @@ as
is
t_sheet pls_integer := nvl( p_sheet, workbook.sheets.count() );
begin
workbook.sheets( t_sheet ).rows( p_row )( p_col ).value := p_value;
workbook.sheets( t_sheet ).rows( p_row )( p_col ).style := null;
workbook.sheets( t_sheet ).rows( p_row )( p_col ).style := get_XfId( t_sheet, p_col, p_row, p_numFmtId, p_fontId, p_fillId, p_borderId, p_alignment );
if p_value is not null
then
workbook.sheets( t_sheet ).rows( p_row )( p_col ).value := p_value;
workbook.sheets( t_sheet ).rows( p_row )( p_col ).style := null;
workbook.sheets( t_sheet ).rows( p_row )( p_col ).style := get_XfId( t_sheet, p_col, p_row, p_numFmtId, p_fontId, p_fillId, p_borderId, p_alignment );
elsif workbook.sheets( t_sheet ).rows( p_row ).exists( p_col )
then
workbook.sheets( t_sheet ).rows( p_row ).delete( p_col );
end if;
end;
--
function add_string( p_string varchar2 )
Expand All @@ -685,6 +691,19 @@ as
workbook.str_cnt := workbook.str_cnt + 1;
return t_cnt;
end;
--
function clean_string (p_string in varchar2)
return varchar2
is
invalid_ascii constant varchar2(32) :=
chr(00)||chr(01)||chr(02)||chr(03)||chr(04)||chr(05)||chr(06)||chr(07)||
chr(08)|| chr(11)||chr(12)|| chr(14)||chr(15)||
chr(16)||chr(17)||chr(18)||chr(19)||chr(20)||chr(21)||chr(22)||chr(23)||
chr(24)||chr(25)||chr(26)||chr(27)||chr(28)||chr(29)||chr(30)||chr(31)
;
begin
return translate(translate( p_string, invalid_ascii, chr(1)), chr(0)||chr(1), ' ');
end;
--
procedure cell
( p_col pls_integer
Expand All @@ -701,12 +720,18 @@ as
t_sheet pls_integer := nvl( p_sheet, workbook.sheets.count() );
t_alignment tp_alignment := p_alignment;
begin
workbook.sheets( t_sheet ).rows( p_row )( p_col ).value := add_string( p_value );
if t_alignment.wrapText is null and instr( p_value, chr(13) ) > 0
if p_value is not null
then
workbook.sheets( t_sheet ).rows( p_row )( p_col ).value := add_string( clean_string( p_value ));
if t_alignment.wrapText is null and instr( p_value, chr(13) ) > 0
then
t_alignment.wrapText := true;
end if;
workbook.sheets( t_sheet ).rows( p_row )( p_col ).style := 't="s" ' || get_XfId( t_sheet, p_col, p_row, p_numFmtId, p_fontId, p_fillId, p_borderId, t_alignment );
elsif workbook.sheets( t_sheet ).rows( p_row ).exists( p_col )
then
t_alignment.wrapText := true;
workbook.sheets( t_sheet ).rows( p_row ).delete( p_col );
end if;
workbook.sheets( t_sheet ).rows( p_row )( p_col ).style := 't="s" ' || get_XfId( t_sheet, p_col, p_row, p_numFmtId, p_fontId, p_fillId, p_borderId, t_alignment );
end;
--
procedure cell
Expand Down Expand Up @@ -749,11 +774,17 @@ as
t_ind pls_integer;
t_sheet pls_integer := nvl( p_sheet, workbook.sheets.count() );
begin
workbook.sheets( t_sheet ).rows( p_row )( p_col ).value := add_string( nvl( p_value, p_url ) );
workbook.sheets( t_sheet ).rows( p_row )( p_col ).style := 't="s" ' || get_XfId( t_sheet, p_col, p_row, '', get_font( 'Calibri', p_theme => 10, p_underline => true ) );
t_ind := workbook.sheets( t_sheet ).hyperlinks.count() + 1;
workbook.sheets( t_sheet ).hyperlinks( t_ind ).cell := alfan_col( p_col ) || p_row;
workbook.sheets( t_sheet ).hyperlinks( t_ind ).url := p_url;
if nvl( p_value, p_url ) is not null
then
workbook.sheets( t_sheet ).rows( p_row )( p_col ).value := add_string( clean_string( nvl( p_value, p_url )));
workbook.sheets( t_sheet ).rows( p_row )( p_col ).style := 't="s" ' || get_XfId( t_sheet, p_col, p_row, '', get_font( 'Calibri', p_theme => 10, p_underline => true ) );
t_ind := workbook.sheets( t_sheet ).hyperlinks.count() + 1;
workbook.sheets( t_sheet ).hyperlinks( t_ind ).cell := alfan_col( p_col ) || p_row;
workbook.sheets( t_sheet ).hyperlinks( t_ind ).url := p_url;
elsif workbook.sheets( t_sheet ).rows( p_row ).exists( p_col )
then
workbook.sheets( t_sheet ).rows( p_row ).delete( p_col );
end if;
end;
--
procedure comment
Expand Down

0 comments on commit 9680b0e

Please sign in to comment.