Skip to content

Commit

Permalink
Fixed bugs related to Encoding = "latin1" and freezing columns and ro…
Browse files Browse the repository at this point in the history
…ws in XLS files. Bumping to 3.3.1 and submitting to CRAN.
  • Loading branch information
marcschwartz committed Jan 21, 2014
1 parent 1aab9fb commit 9c746bc
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 10 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
@@ -1,6 +1,6 @@
Package: WriteXLS
Version: 3.2.2
Date: 2013-11-12
Version: 3.3.1
Date: 2014-01-20
Title: Cross-platform Perl based R function to create Excel 2003 (XLS) and Excel 2007 (XLSX) files
Description: Cross-platform Perl based R function to create Excel 2003 (XLS) and Excel 2007 (XLSX)
files from one or more data frames. Each data frame will be
Expand Down
8 changes: 4 additions & 4 deletions inst/Perl/WriteXLS.pl
Expand Up @@ -6,7 +6,7 @@
#
# Write to an Excel binary file.
#
# Copyright 2013, Marc Schwartz <marc_schwartz@me.com>
# Copyright 2014, Marc Schwartz <marc_schwartz@me.com>
#
# This software is distributed under the terms of the GNU General
# Public License Version 2, June 1991.
Expand Down Expand Up @@ -279,7 +279,7 @@ sub string_width {
if ($Encoding eq "UTF-8") {
$WorkSheet->write_comment(0, $Column, decode_utf8($Fld));
} else {
$WorkSheet->write_comment(0, $Column, decode_utf8("iso-8859-1", $Fld));
$WorkSheet->write_comment(0, $Column, decode("iso-8859-1", $Fld));
}
}

Expand All @@ -293,7 +293,7 @@ sub string_width {
if ($Encoding eq "UTF-8") {
$WorkSheet->write($Row, $Column, decode_utf8($Fld));
} else {
$WorkSheet->write($Row, $Column, decode_utf8("iso-8859-1", $Fld));
$WorkSheet->write($Row, $Column, decode("iso-8859-1", $Fld));
}

$Column++;
Expand All @@ -316,7 +316,7 @@ sub string_width {
$WorkSheet->autofilter(0, 0, $Row - 1, $Column - 1);
}

if (($FreezeRow != 0) && ($FreezeCol != 0)) {
if (($FreezeRow > 0) || ($FreezeCol > 0)) {
$WorkSheet->freeze_panes($FreezeRow, $FreezeCol);
}
}
Expand Down
8 changes: 4 additions & 4 deletions inst/Perl/WriteXLSX.pl
Expand Up @@ -6,7 +6,7 @@
#
# Write to an Excel binary file.
#
# Copyright 2013, Marc Schwartz <marc_schwartz@me.com>
# Copyright 2014, Marc Schwartz <marc_schwartz@me.com>
#
# This software is distributed under the terms of the GNU General
# Public License Version 2, June 1991.
Expand Down Expand Up @@ -279,7 +279,7 @@ sub string_width {
if ($Encoding eq "UTF-8") {
$WorkSheet->write_comment(0, $Column, decode_utf8($Fld));
} else {
$WorkSheet->write_comment(0, $Column, decode_utf8("iso-8859-1", $Fld));
$WorkSheet->write_comment(0, $Column, decode("iso-8859-1", $Fld));
}
}

Expand All @@ -293,7 +293,7 @@ sub string_width {
if ($Encoding eq "UTF-8") {
$WorkSheet->write($Row, $Column, decode_utf8($Fld));
} else {
$WorkSheet->write($Row, $Column, decode_utf8("iso-8859-1", $Fld));
$WorkSheet->write($Row, $Column, decode("iso-8859-1", $Fld));
}

$Column++;
Expand All @@ -316,7 +316,7 @@ sub string_width {
$WorkSheet->autofilter(0, 0, $Row - 1, $Column - 1);
}

if (($FreezeRow != 0) || ($FreezeCol != 0)) {
if (($FreezeRow > 0) || ($FreezeCol > 0)) {
$WorkSheet->freeze_panes($FreezeRow, $FreezeCol);
}
}
Expand Down
4 changes: 4 additions & 0 deletions man/WriteXLS.Rd
Expand Up @@ -222,13 +222,17 @@
WriteXLS("iris", "irisrownames.xlsx",
AdjWidth = TRUE, BoldHeaderRow = TRUE, row.names = TRUE)

# Use latin1 Encoding
WriteXLS("iris", "irisLatin1.xls", Encoding = "latin1")

# Clean up and delete XLS files
rm(iris.split)
unlink("iris.xls")
unlink("Example.xls")
unlink("irissplit.xls")
unlink("iriscomments.xlsx")
unlink("irisrownames.xlsx")
unlink("irisLatin1.xls")
}
}
\keyword{file}

0 comments on commit 9c746bc

Please sign in to comment.