Class: XlsxWriter::Chartsheet

Inherits:
Object
  • Object
show all
Defined in:
ext/xlsxwriter/chartsheet.c

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Object

:nodoc:



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'ext/xlsxwriter/chartsheet.c', line 25

VALUE
chartsheet_init(int argc, VALUE *argv, VALUE self) {
  char *name = NULL;
  struct workbook *wb_ptr;
  struct chartsheet *ptr;

  Data_Get_Struct(self, struct chartsheet, ptr);

  if (argc == 2) {
    name = StringValueCStr(argv[1]);
  }

  rb_iv_set(self, "@workbook", argv[0]);

  Data_Get_Struct(argv[0], struct workbook, 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

#activateself

Set the chartsheet to be active on opening the workbook.

Returns:

  • (self)


69
70
71
72
73
# File 'ext/xlsxwriter/chartsheet.c', line 69

VALUE
chartsheet_activate_(VALUE self) {
  LXW_NO_RESULT_CALL(chartsheet, activate);
  return self;
}

#chart=(chart) ⇒ Object

Set the chart chartsheet contains.



79
80
81
82
83
84
85
86
# File 'ext/xlsxwriter/chartsheet.c', line 79

VALUE
chartsheet_set_chart_(VALUE self, VALUE chart) {
  struct chart *chart_ptr;
  Data_Get_Struct(chart, struct chart, chart_ptr);

  LXW_ERR_RESULT_CALL(chartsheet, set_chart, chart_ptr->chart);
  return self;
}

#freeObject

:nodoc:



47
48
49
50
51
52
53
54
# File 'ext/xlsxwriter/chartsheet.c', line 47

VALUE
chartsheet_release(VALUE self) {
  struct chartsheet *ptr;
  Data_Get_Struct(self, struct chartsheet, ptr);

  chartsheet_free(ptr);
  return self;
}

#hideself

Hide the chartsheet.

Returns:

  • (self)


92
93
94
95
96
# File 'ext/xlsxwriter/chartsheet.c', line 92

VALUE
chartsheet_hide_(VALUE self) {
  LXW_NO_RESULT_CALL(chartsheet, hide);
  return self;
}

#horizontal_dpiInteger

Returns the horizontal dpi.

Returns:

  • (Integer)


236
237
238
239
240
241
# File 'ext/xlsxwriter/chartsheet.c', line 236

VALUE
chartsheet_get_horizontal_dpi_(VALUE self) {
  struct chartsheet *ptr;
  Data_Get_Struct(self, struct chartsheet, ptr);
  return INT2NUM(ptr->chartsheet->worksheet->horizontal_dpi);
}

#horizontal_dpi=(dpi) ⇒ Object

Sets the horizontal dpi.



247
248
249
250
251
252
253
# File 'ext/xlsxwriter/chartsheet.c', line 247

VALUE
chartsheet_set_horizontal_dpi_(VALUE self, VALUE val) {
  struct chartsheet *ptr;
  Data_Get_Struct(self, struct chartsheet, ptr);
  ptr->chartsheet->worksheet->horizontal_dpi = NUM2INT(val);
  return val;
}

#paper=(type) ⇒ Object

Sets the paper type for printing. See libxlsxwriter doc for options.



102
103
104
105
106
# File 'ext/xlsxwriter/chartsheet.c', line 102

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.

Returns:

  • (self)


114
115
116
117
118
119
120
# File 'ext/xlsxwriter/chartsheet.c', line 114

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;
}

#selectself

Set the chartsheet to be selected on opening the workbook.

Returns:

  • (self)


157
158
159
160
161
# File 'ext/xlsxwriter/chartsheet.c', line 157

VALUE
chartsheet_select_(VALUE self) {
  LXW_NO_RESULT_CALL(chartsheet, select);
  return self;
}

#set_fitst_sheetself

Set the sheet to be the first visible in the sheets list (which is placed under the work area in Excel).

Returns:

  • (self)


127
128
129
130
131
# File 'ext/xlsxwriter/chartsheet.c', line 127

VALUE
chartsheet_set_first_sheet_(VALUE self) {
  LXW_NO_RESULT_CALL(chartsheet, set_first_sheet);
  return self;
}

See Worksheet#set_header for params description.



137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# File 'ext/xlsxwriter/chartsheet.c', line 137

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;
  Data_Get_Struct(self, struct chartsheet, 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.



167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
# File 'ext/xlsxwriter/chartsheet.c', line 167

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;
  Data_Get_Struct(self, struct chartsheet, 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_landscapeself

Sets print orientation of the chartsheet to landscape.

Returns:

  • (self)


187
188
189
190
191
# File 'ext/xlsxwriter/chartsheet.c', line 187

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.



194
195
196
197
198
# File 'ext/xlsxwriter/chartsheet.c', line 194

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_portraitself

Sets print orientation of the chartsheet to portrait.

Returns:

  • (self)


204
205
206
207
208
# File 'ext/xlsxwriter/chartsheet.c', line 204

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


216
217
218
219
220
# File 'ext/xlsxwriter/chartsheet.c', line 216

VALUE
chartsheet_set_tab_color_(VALUE self, VALUE color) {
  LXW_NO_RESULT_CALL(chartsheet, set_tab_color, NUM2INT(color));
  return color;
}

#vertical_dpiInteger

Returns the vertical dpi.

Returns:

  • (Integer)


259
260
261
262
263
264
# File 'ext/xlsxwriter/chartsheet.c', line 259

VALUE
chartsheet_get_vertical_dpi_(VALUE self) {
  struct chartsheet *ptr;
  Data_Get_Struct(self, struct chartsheet, ptr);
  return INT2NUM(ptr->chartsheet->worksheet->vertical_dpi);
}

#vertical_dpi=(dpi) ⇒ Object

Sets the vertical dpi.



270
271
272
273
274
275
276
# File 'ext/xlsxwriter/chartsheet.c', line 270

VALUE
chartsheet_set_vertical_dpi_(VALUE self, VALUE val) {
  struct chartsheet *ptr;
  Data_Get_Struct(self, struct chartsheet, ptr);
  ptr->chartsheet->worksheet->vertical_dpi = NUM2INT(val);
  return val;
}

#zoom=(zoom) ⇒ Object

Sets the worksheet zoom factor in the range 10 <= zoom <= 400.



226
227
228
229
230
# File 'ext/xlsxwriter/chartsheet.c', line 226

VALUE
chartsheet_set_zoom_(VALUE self, VALUE val) {
  LXW_NO_RESULT_CALL(chartsheet, set_zoom, NUM2INT(val));
  return self;
}