[gnumeric] Implement printing of errors as dashes or NAs.



commit cd09d080441dea48d65860de04baa47e379eb45b
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date:   Thu Jul 28 12:11:41 2011 -0600

    Implement printing of errors as dashes or NAs.
    
    2011-07-28 Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* src/print-cell.c (print_cell_gtk): implement printing of errors as
    	NA and as dashes

 ChangeLog        |    5 +++++
 NEWS             |    2 +-
 src/print-cell.c |   20 +++++++++++++++++++-
 3 files changed, 25 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index f3be344..2427dd8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2011-07-28 Andreas J. Guelzow <aguelzow pyrshep ca>
 
+	* src/print-cell.c (print_cell_gtk): implement printing of errors as
+	NA and as dashes
+
+2011-07-28 Andreas J. Guelzow <aguelzow pyrshep ca>
+
 	* src/print-cell.c (print_cell_gtk): be sure that the value is
 	uptodate
 
diff --git a/NEWS b/NEWS
index bf1c3ce..a8e3ef7 100644
--- a/NEWS
+++ b/NEWS
@@ -14,7 +14,7 @@ Andreas:
 	* Speed up frequent calls to INTERPOLATION with the same 
 	abscissae/ordinates. [#654538]
 	* Export defined names to xlsx. [#655010]
-	* Implement printing of errors as blanks.
+	* Implement printing of errors as blanks, dashes or NAs.
 	* Fix printing of column headers and borders when formulae are shown. 
 	[#655389]
 
diff --git a/src/print-cell.c b/src/print-cell.c
index 7033a9b..b8caa65 100644
--- a/src/print-cell.c
+++ b/src/print-cell.c
@@ -86,7 +86,25 @@ print_cell_gtk (GnmCell const *cell,
 	rv = gnm_cell_fetch_rendered_value (cell, TRUE);
 
 	/* Create a rendered value for printing */
-	if (sheet->last_zoom_factor_used != 1) {
+	if (cell_shows_error && (pinfo->error_display == PRINT_ERRORS_AS_NA
+				 || pinfo->error_display == PRINT_ERRORS_AS_DASHES)) {
+		GnmCell *t_cell = (GnmCell *)cell;
+		GnmValue *old = t_cell->value;
+		if (pinfo->error_display == PRINT_ERRORS_AS_NA)
+			t_cell->value = value_new_error_NA (NULL);
+		else
+			t_cell->value = value_new_error 
+				(NULL, 
+				 /* U+2014 U+200A U+2014 */
+				 "\342\200\224\342\200\212\342\200\224");
+		rv100 = gnm_rendered_value_new (t_cell,
+						pango_layout_get_context (rv->layout),
+						rv->variable_width,
+						1.0);
+		rv = rv100;
+		value_release (t_cell->value);
+		t_cell->value = old;
+	} else if (sheet->last_zoom_factor_used != 1) {
 		/*
 		 * We're zoomed and we don't want printing to reflect that.
 		 */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]