Class: XlsxWriter::Chartsheet
- Inherits:
-
Object
- Object
- XlsxWriter::Chartsheet
- Defined in:
- ext/xlsxwriter/chartsheet.c
Instance Method Summary collapse
-
#activate ⇒ self
Set the chartsheet to be active on opening the workbook.
-
#chart=(chart) ⇒ Object
Set the chart chartsheet contains.
-
#free ⇒ Object
:nodoc:.
-
#hide ⇒ self
Hide the chartsheet.
-
#horizontal_dpi ⇒ Integer
Returns the horizontal dpi.
-
#horizontal_dpi=(dpi) ⇒ Object
Sets the horizontal dpi.
-
#initialize(*args) ⇒ Object
constructor
:nodoc:.
-
#paper=(type) ⇒ Object
Sets the paper
type
for printing. -
#protect(password[, opts]) ⇒ self
Protects the worksheet elements from modification.
-
#select ⇒ self
Set the chartsheet to be selected on opening the workbook.
-
#set_fitst_sheet ⇒ self
Set the sheet to be the first visible in the sheets list (which is placed under the work area in Excel).
-
#set_footer(text[, opts]) ⇒ Object
See Worksheet#set_header for params description.
-
#set_header(text[, opts]) ⇒ Object
See Worksheet#set_header for params description.
-
#set_landscape ⇒ self
Sets print orientation of the chartsheet to landscape.
-
#set_margins(left, right, top, bottom) ⇒ Object
Sets the chartsheet margins (Numeric) for the printed page.
-
#set_portrait ⇒ self
Sets print orientation of the chartsheet to portrait.
-
#tab_color=(color) ⇒ Object
Set the tab color (from RGB integer).
-
#vertical_dpi ⇒ Integer
Returns the vertical dpi.
-
#vertical_dpi=(dpi) ⇒ Object
Sets the vertical dpi.
-
#zoom=(zoom) ⇒ Object
Sets the worksheet zoom factor in the range 10 <=
zoom
<= 400.
Constructor Details
#initialize(*args) ⇒ Object
:nodoc:
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'ext/xlsxwriter/chartsheet.c', line 41
VALUE
chartsheet_init(int argc, VALUE *argv, VALUE self) {
char *name = NULL;
struct workbook *wb_ptr;
struct chartsheet *ptr;
TypedData_Get_Struct(self, struct chartsheet, &chartsheet_type, ptr);
if (argc == 2) {
name = StringValueCStr(argv[1]);
}
rb_iv_set(self, "@workbook", argv[0]);
TypedData_Get_Struct(argv[0], struct workbook, &workbook_type, wb_ptr);
ptr->chartsheet = workbook_add_chartsheet(wb_ptr->workbook, name);
if (!ptr->chartsheet)
rb_raise(eXlsxWriterError, "chartsheet was not created");
return self;
}
|
Instance Method Details
#activate ⇒ self
Set the chartsheet to be active on opening the workbook.
90 91 92 93 94 |
# File 'ext/xlsxwriter/chartsheet.c', line 90 VALUE chartsheet_activate_(VALUE self) { LXW_NO_RESULT_CALL(chartsheet, activate); return self; } |
#chart=(chart) ⇒ Object
Set the chart chartsheet contains.
100 101 102 103 104 105 106 107 |
# File 'ext/xlsxwriter/chartsheet.c', line 100
VALUE
chartsheet_set_chart_(VALUE self, VALUE chart) {
struct chart *chart_ptr;
TypedData_Get_Struct(chart, struct chart, &chart_type, chart_ptr);
LXW_ERR_RESULT_CALL(chartsheet, set_chart, chart_ptr->chart);
return self;
}
|
#free ⇒ Object
:nodoc:
63 64 65 66 67 68 69 70 |
# File 'ext/xlsxwriter/chartsheet.c', line 63
VALUE
chartsheet_release(VALUE self) {
struct chartsheet *ptr;
TypedData_Get_Struct(self, struct chartsheet, &chartsheet_type, ptr);
chartsheet_clear(ptr);
return self;
}
|
#hide ⇒ self
Hide the chartsheet.
113 114 115 116 117 |
# File 'ext/xlsxwriter/chartsheet.c', line 113 VALUE chartsheet_hide_(VALUE self) { LXW_NO_RESULT_CALL(chartsheet, hide); return self; } |
#horizontal_dpi ⇒ Integer
Returns the horizontal dpi.
257 258 259 260 261 262 |
# File 'ext/xlsxwriter/chartsheet.c', line 257
VALUE
chartsheet_get_horizontal_dpi_(VALUE self) {
struct chartsheet *ptr;
TypedData_Get_Struct(self, struct chartsheet, &chartsheet_type, ptr);
return INT2NUM(ptr->chartsheet->worksheet->horizontal_dpi);
}
|
#horizontal_dpi=(dpi) ⇒ Object
Sets the horizontal dpi.
268 269 270 271 272 273 274 |
# File 'ext/xlsxwriter/chartsheet.c', line 268
VALUE
chartsheet_set_horizontal_dpi_(VALUE self, VALUE val) {
struct chartsheet *ptr;
TypedData_Get_Struct(self, struct chartsheet, &chartsheet_type, ptr);
ptr->chartsheet->worksheet->horizontal_dpi = NUM2INT(val);
return val;
}
|
#paper=(type) ⇒ Object
Sets the paper type
for printing. See libxlsxwriter doc for options.
123 124 125 126 127 |
# File 'ext/xlsxwriter/chartsheet.c', line 123
VALUE
chartsheet_set_paper_(VALUE self, VALUE paper_type) {
LXW_NO_RESULT_CALL(chartsheet, set_paper, NUM2INT(paper_type));
return self;
}
|
#protect(password[, opts]) ⇒ self
Protects the worksheet elements from modification. See libxlsxwriter doc for options.
135 136 137 138 139 140 141 |
# File 'ext/xlsxwriter/chartsheet.c', line 135
VALUE
chartsheet_protect_(int argc, VALUE *argv, VALUE self) {
rb_check_arity(argc, 0, 2);
struct _protect_options po = _extract_protect_options(argc, argv);
LXW_NO_RESULT_CALL(chartsheet, protect, po.password, (po.with_options ? &po.options : NULL));
return self;
}
|
#select ⇒ self
Set the chartsheet to be selected on opening the workbook.
178 179 180 181 182 |
# File 'ext/xlsxwriter/chartsheet.c', line 178 VALUE chartsheet_select_(VALUE self) { LXW_NO_RESULT_CALL(chartsheet, select); return self; } |
#set_fitst_sheet ⇒ self
Set the sheet to be the first visible in the sheets list (which is placed under the work area in Excel).
148 149 150 151 152 |
# File 'ext/xlsxwriter/chartsheet.c', line 148 VALUE chartsheet_set_first_sheet_(VALUE self) { LXW_NO_RESULT_CALL(chartsheet, set_first_sheet); return self; } |
#set_footer(text[, opts]) ⇒ Object
See Worksheet#set_header for params description.
158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 |
# File 'ext/xlsxwriter/chartsheet.c', line 158
VALUE
chartsheet_set_footer_(int argc, VALUE *argv, VALUE self) {
rb_check_arity(argc, 1, 2);
struct _header_options ho = _extract_header_options(argc, argv);
struct chartsheet *ptr;
TypedData_Get_Struct(self, struct chartsheet, &chartsheet_type, ptr);
lxw_error err;
if (!ho.with_options) {
err = chartsheet_set_footer(ptr->chartsheet, ho.str);
} else {
err = chartsheet_set_footer_opt(ptr->chartsheet, ho.str, &ho.options);
}
handle_lxw_error(err);
return self;
}
|
#set_header(text[, opts]) ⇒ Object
See Worksheet#set_header for params description.
188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 |
# File 'ext/xlsxwriter/chartsheet.c', line 188
VALUE
chartsheet_set_header_(int argc, VALUE *argv, VALUE self) {
rb_check_arity(argc, 1, 2);
struct _header_options ho = _extract_header_options(argc, argv);
struct chartsheet *ptr;
TypedData_Get_Struct(self, struct chartsheet, &chartsheet_type, ptr);
lxw_error err;
if (!ho.with_options) {
err = chartsheet_set_header(ptr->chartsheet, ho.str);
} else {
err = chartsheet_set_header_opt(ptr->chartsheet, ho.str, &ho.options);
}
handle_lxw_error(err);
return self;
}
|
#set_landscape ⇒ self
Sets print orientation of the chartsheet to landscape.
208 209 210 211 212 |
# File 'ext/xlsxwriter/chartsheet.c', line 208 VALUE chartsheet_set_landscape_(VALUE self) { LXW_NO_RESULT_CALL(chartsheet, set_landscape); return self; } |
#set_margins(left, right, top, bottom) ⇒ Object
Sets the chartsheet margins (Numeric) for the printed page.
215 216 217 218 219 |
# File 'ext/xlsxwriter/chartsheet.c', line 215
VALUE
chartsheet_set_margins_(VALUE self, VALUE left, VALUE right, VALUE top, VALUE bottom) {
LXW_NO_RESULT_CALL(chartsheet, set_margins, NUM2DBL(left), NUM2DBL(right), NUM2DBL(top), NUM2DBL(bottom));
return self;
}
|
#set_portrait ⇒ self
Sets print orientation of the chartsheet to portrait.
225 226 227 228 229 |
# File 'ext/xlsxwriter/chartsheet.c', line 225 VALUE chartsheet_set_portrait_(VALUE self) { LXW_NO_RESULT_CALL(chartsheet, set_portrait); return self; } |
#tab_color=(color) ⇒ Object
Set the tab color (from RGB integer).
ws.tab_color = 0xF0F0F0
237 238 239 240 241 |
# File 'ext/xlsxwriter/chartsheet.c', line 237
VALUE
chartsheet_set_tab_color_(VALUE self, VALUE color) {
LXW_NO_RESULT_CALL(chartsheet, set_tab_color, NUM2INT(color));
return color;
}
|
#vertical_dpi ⇒ Integer
Returns the vertical dpi.
280 281 282 283 284 285 |
# File 'ext/xlsxwriter/chartsheet.c', line 280
VALUE
chartsheet_get_vertical_dpi_(VALUE self) {
struct chartsheet *ptr;
TypedData_Get_Struct(self, struct chartsheet, &chartsheet_type, ptr);
return INT2NUM(ptr->chartsheet->worksheet->vertical_dpi);
}
|
#vertical_dpi=(dpi) ⇒ Object
Sets the vertical dpi.
291 292 293 294 295 296 297 |
# File 'ext/xlsxwriter/chartsheet.c', line 291
VALUE
chartsheet_set_vertical_dpi_(VALUE self, VALUE val) {
struct chartsheet *ptr;
TypedData_Get_Struct(self, struct chartsheet, &chartsheet_type, ptr);
ptr->chartsheet->worksheet->vertical_dpi = NUM2INT(val);
return val;
}
|
#zoom=(zoom) ⇒ Object
Sets the worksheet zoom factor in the range 10 <= zoom
<= 400.
247 248 249 250 251 |
# File 'ext/xlsxwriter/chartsheet.c', line 247
VALUE
chartsheet_set_zoom_(VALUE self, VALUE val) {
LXW_NO_RESULT_CALL(chartsheet, set_zoom, NUM2INT(val));
return self;
}
|