xlsxwriter 0.2.1.pre → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +4 -3
- data/ext/xlsxwriter/chart.c +88 -80
- data/ext/xlsxwriter/chart.h +2 -2
- data/ext/xlsxwriter/chartsheet.c +307 -0
- data/ext/xlsxwriter/chartsheet.h +15 -0
- data/ext/xlsxwriter/common.h +104 -0
- data/ext/xlsxwriter/extconf.rb +8 -8
- data/ext/xlsxwriter/libxlsxwriter/License.txt +24 -2
- data/ext/xlsxwriter/libxlsxwriter/Makefile +46 -12
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/app.h +1 -1
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/chart.h +196 -30
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/chartsheet.h +3 -3
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/comment.h +76 -0
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/common.h +24 -5
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/content_types.h +5 -1
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/core.h +1 -1
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/custom.h +1 -1
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/drawing.h +6 -17
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/format.h +20 -6
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/hash_table.h +1 -1
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/packager.h +3 -1
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/relationships.h +1 -1
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/shared_strings.h +1 -1
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/styles.h +11 -5
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/theme.h +1 -1
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/third_party/md5.h +43 -0
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/utility.h +42 -3
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/vml.h +55 -0
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/workbook.h +83 -18
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/worksheet.h +1519 -109
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/xmlwriter.h +4 -2
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter.h +3 -2
- data/ext/xlsxwriter/libxlsxwriter/src/Makefile +25 -7
- data/ext/xlsxwriter/libxlsxwriter/src/app.c +1 -1
- data/ext/xlsxwriter/libxlsxwriter/src/chart.c +332 -48
- data/ext/xlsxwriter/libxlsxwriter/src/chartsheet.c +20 -19
- data/ext/xlsxwriter/libxlsxwriter/src/comment.c +443 -0
- data/ext/xlsxwriter/libxlsxwriter/src/content_types.c +20 -1
- data/ext/xlsxwriter/libxlsxwriter/src/core.c +2 -2
- data/ext/xlsxwriter/libxlsxwriter/src/custom.c +1 -1
- data/ext/xlsxwriter/libxlsxwriter/src/drawing.c +58 -20
- data/ext/xlsxwriter/libxlsxwriter/src/format.c +98 -25
- data/ext/xlsxwriter/libxlsxwriter/src/hash_table.c +1 -1
- data/ext/xlsxwriter/libxlsxwriter/src/packager.c +269 -12
- data/ext/xlsxwriter/libxlsxwriter/src/relationships.c +1 -1
- data/ext/xlsxwriter/libxlsxwriter/src/shared_strings.c +2 -4
- data/ext/xlsxwriter/libxlsxwriter/src/styles.c +334 -48
- data/ext/xlsxwriter/libxlsxwriter/src/theme.c +1 -1
- data/ext/xlsxwriter/libxlsxwriter/src/utility.c +71 -8
- data/ext/xlsxwriter/libxlsxwriter/src/vml.c +1032 -0
- data/ext/xlsxwriter/libxlsxwriter/src/workbook.c +343 -27
- data/ext/xlsxwriter/libxlsxwriter/src/worksheet.c +3759 -478
- data/ext/xlsxwriter/libxlsxwriter/src/xmlwriter.c +81 -2
- data/ext/xlsxwriter/libxlsxwriter/third_party/md5/Makefile +42 -0
- data/ext/xlsxwriter/libxlsxwriter/third_party/md5/md5.c +291 -0
- data/ext/xlsxwriter/libxlsxwriter/third_party/md5/md5.h +43 -0
- data/ext/xlsxwriter/shared_strings.c +65 -0
- data/ext/xlsxwriter/shared_strings.h +15 -0
- data/ext/xlsxwriter/workbook.c +96 -20
- data/ext/xlsxwriter/worksheet.c +125 -235
- data/ext/xlsxwriter/worksheet.h +2 -1
- data/ext/xlsxwriter/xlsxwriter.c +4 -0
- data/lib/xlsxwriter/rich_string.rb +0 -2
- data/lib/xlsxwriter/version.rb +1 -1
- data/lib/xlsxwriter/worksheet.rb +2 -2
- data/test/{run-test.rb → run_test.rb} +3 -3
- data/test/support/chart_test.rb +3 -3
- data/test/support/with_xlsx_file.rb +4 -2
- data/test/support/xlsx_comparable.rb +40 -26
- data/test/test_array_formula.rb +42 -0
- data/test/test_autofilter.rb +72 -0
- data/test/{test-chart-area.rb → test_chart_area.rb} +2 -2
- data/test/{test-chart-axis.rb → test_chart_axis.rb} +16 -16
- data/test/test_chart_bar.rb +382 -0
- data/test/test_chart_blank.rb +27 -0
- data/test/{test-chart-column.rb → test_chart_column.rb} +2 -2
- data/test/{test-chart-doughnut.rb → test_chart_doughnut.rb} +2 -2
- data/test/{test-chart-legend.rb → test_chart_legend.rb} +2 -2
- data/test/{test-chart-pie.rb → test_chart_pie.rb} +2 -2
- data/test/{test-chart-scatter.rb → test_chart_scatter.rb} +3 -4
- data/test/{test-chart-size.rb → test_chart_size.rb} +2 -2
- data/test/{test-chart-title.rb → test_chart_title.rb} +3 -3
- data/test/test_chartsheet.rb +201 -0
- data/test/{test-data.rb → test_data.rb} +1 -1
- data/test/{test-data-validation.rb → test_data_validation.rb} +23 -24
- data/test/{test-default-row.rb → test_default_row.rb} +1 -1
- data/test/{test-defined-name.rb → test_defined_name.rb} +12 -12
- data/test/{test-escapes.rb → test_escapes.rb} +5 -2
- data/test/{test-fit-to-pages.rb → test_fit_to_pages.rb} +6 -6
- data/test/{test-formatting.rb → test_formatting.rb} +10 -10
- data/test/{test-gridlines.rb → test_gridlines.rb} +3 -3
- data/test/{test-hyperlink.rb → test_hyperlink.rb} +22 -11
- data/test/{test-image.rb → test_image.rb} +6 -4
- data/test/{test-macro.rb → test_macro.rb} +1 -1
- data/test/{test-merge-range.rb → test_merge_range.rb} +1 -1
- data/test/{test-misc.rb → test_misc.rb} +2 -2
- data/test/{test-optimize.rb → test_optimize.rb} +2 -4
- data/test/{test-outline.rb → test_outline.rb} +14 -14
- data/test/{test-page-breaks.rb → test_page_breaks.rb} +2 -2
- data/test/{test-page-setup.rb → test_page_setup.rb} +2 -2
- data/test/{test-panes.rb → test_panes.rb} +1 -1
- data/test/{test-print-area.rb → test_print_area.rb} +3 -3
- data/test/{test-print-options.rb → test_print_options.rb} +7 -7
- data/test/{test-print-scale.rb → test_print_scale.rb} +2 -2
- data/test/{test-properties.rb → test_properties.rb} +2 -2
- data/test/{test-protect.rb → test_protect.rb} +3 -3
- data/test/{test-repeat.rb → test_repeat.rb} +3 -3
- data/test/{test-rich-string.rb → test_rich_string.rb} +5 -9
- data/test/{test-row-col-format.rb → test_row_col_format.rb} +1 -1
- data/test/{test-ruby-worksheet.rb → test_ruby_worksheet.rb} +2 -2
- data/test/{test-set-selection.rb → test_set_selection.rb} +2 -2
- data/test/{test-set-start-page.rb → test_set_start_page.rb} +2 -2
- data/test/{test-simple.rb → test_simple.rb} +10 -10
- data/test/{test-types.rb → test_types.rb} +1 -1
- data/test/{xlsx-func-testcase.rb → xlsx_func_testcase.rb} +1 -0
- metadata +135 -104
- data/test/test-array-formula.rb +0 -35
- data/test/test-autofilter.rb +0 -72
- data/test/test-chart-bar.rb +0 -74
- /data/test/{test-errors.rb → test_errors.rb} +0 -0
data/ext/xlsxwriter/workbook.c
CHANGED
@@ -2,8 +2,12 @@
|
|
2
2
|
#include <ruby.h>
|
3
3
|
#include <ruby/thread.h>
|
4
4
|
#include <xlsxwriter.h>
|
5
|
+
|
5
6
|
#include "chart.h"
|
7
|
+
#include "chartsheet.h"
|
8
|
+
#include "common.h"
|
6
9
|
#include "format.h"
|
10
|
+
#include "shared_strings.h"
|
7
11
|
#include "workbook.h"
|
8
12
|
#include "workbook_properties.h"
|
9
13
|
#include "worksheet.h"
|
@@ -197,6 +201,38 @@ workbook_add_worksheet_(int argc, VALUE *argv, VALUE self) {
|
|
197
201
|
return worksheet;
|
198
202
|
}
|
199
203
|
|
204
|
+
/* call-seq:
|
205
|
+
* wb.add_chartsheet([name]) -> cs
|
206
|
+
* wb.add_chartsheet([name]) { |ws| block } -> obj
|
207
|
+
*
|
208
|
+
* Adds a chartsheet named +name+ to the workbook.
|
209
|
+
*
|
210
|
+
* If a block is passed, the last statement is returned.
|
211
|
+
*
|
212
|
+
* wb.add_chartsheet('Cool chart') do |cs|
|
213
|
+
* cs.chart = chart
|
214
|
+
* end
|
215
|
+
*/
|
216
|
+
VALUE
|
217
|
+
workbook_add_chartsheet_(int argc, VALUE *argv, VALUE self) {
|
218
|
+
VALUE chartsheet = Qnil;
|
219
|
+
|
220
|
+
rb_check_arity(argc, 0, 1);
|
221
|
+
|
222
|
+
struct workbook *ptr;
|
223
|
+
Data_Get_Struct(self, struct workbook, ptr);
|
224
|
+
if (ptr->workbook) {
|
225
|
+
chartsheet = rb_funcall(cChartsheet, rb_intern("new"), argc + 1, self, argv[0]);
|
226
|
+
}
|
227
|
+
|
228
|
+
if (rb_block_given_p()) {
|
229
|
+
VALUE res = rb_yield(chartsheet);
|
230
|
+
return res;
|
231
|
+
}
|
232
|
+
|
233
|
+
return chartsheet;
|
234
|
+
}
|
235
|
+
|
200
236
|
/* call-seq:
|
201
237
|
* wb.add_format(key, definition) -> wb
|
202
238
|
*
|
@@ -210,7 +246,7 @@ workbook_add_worksheet_(int argc, VALUE *argv, VALUE self) {
|
|
210
246
|
* :font_color:: Text color.
|
211
247
|
* :bold, :italic, underline :: Bold, italic, underlined text.
|
212
248
|
* :font_strikeout:: Striked out text.
|
213
|
-
* :font_script:: Superscript (
|
249
|
+
* :font_script:: Superscript (XlsxWriter::Format::FONT_SUPERSCRIPT) or subscript (XlsxWriter::Format::FONT_SUBSCRIPT).
|
214
250
|
* :num_format:: Defines numerical format with mask, like <code>'d mmm yyyy'</code>
|
215
251
|
* or <code>'#,##0.00'</code>.
|
216
252
|
* :num_format_index:: Defines numerical format from special {pre-defined set}[https://libxlsxwriter.github.io/format_8h.html#a688aa42bcc703d17e125d9a34c721872].
|
@@ -291,12 +327,7 @@ workbook_add_chart_(VALUE self, VALUE type) {
|
|
291
327
|
*/
|
292
328
|
VALUE
|
293
329
|
workbook_add_vba_project_(VALUE self, VALUE filename) {
|
294
|
-
|
295
|
-
Data_Get_Struct(self, struct workbook, ptr);
|
296
|
-
|
297
|
-
lxw_error err = workbook_add_vba_project(ptr->workbook, StringValueCStr(filename));
|
298
|
-
handle_lxw_error(err);
|
299
|
-
|
330
|
+
LXW_ERR_RESULT_CALL(workbook, add_vba_project, StringValueCStr(filename));
|
300
331
|
return self;
|
301
332
|
}
|
302
333
|
|
@@ -316,18 +347,13 @@ workbook_set_default_xf_indices_(VALUE self) {
|
|
316
347
|
*/
|
317
348
|
VALUE
|
318
349
|
workbook_set_vba_name_(VALUE self, VALUE name) {
|
319
|
-
|
320
|
-
Data_Get_Struct(self, struct workbook, ptr);
|
321
|
-
|
322
|
-
lxw_error err = workbook_set_vba_name(ptr->workbook, StringValueCStr(name));
|
323
|
-
handle_lxw_error(err);
|
324
|
-
|
350
|
+
LXW_ERR_RESULT_CALL(workbook, set_vba_name, StringValueCStr(name));
|
325
351
|
return name;
|
326
352
|
}
|
327
353
|
|
328
354
|
/* call-seq: wb.properties -> wb_properties
|
329
355
|
*
|
330
|
-
* Returns
|
356
|
+
* Returns workbook properties accessor object.
|
331
357
|
*
|
332
358
|
* wb.properties.title = 'My awesome sheet'
|
333
359
|
*/
|
@@ -346,12 +372,61 @@ workbook_properties_(VALUE self) {
|
|
346
372
|
*/
|
347
373
|
VALUE
|
348
374
|
workbook_define_name_(VALUE self, VALUE name, VALUE formula) {
|
375
|
+
LXW_ERR_RESULT_CALL(workbook, define_name, StringValueCStr(name), StringValueCStr(formula));
|
376
|
+
|
377
|
+
return self;
|
378
|
+
}
|
379
|
+
|
380
|
+
/* call-seq: wb.unset_default_url_format -> wb
|
381
|
+
*
|
382
|
+
* Unsets default url format
|
383
|
+
*/
|
384
|
+
VALUE
|
385
|
+
workbook_unset_default_url_format_(VALUE self) {
|
349
386
|
struct workbook *ptr;
|
387
|
+
|
350
388
|
Data_Get_Struct(self, struct workbook, ptr);
|
351
|
-
|
389
|
+
workbook_unset_default_url_format(ptr->workbook);
|
390
|
+
|
352
391
|
return self;
|
353
392
|
}
|
354
393
|
|
394
|
+
/* call-seq: wb.max_url_length -> Integer
|
395
|
+
*/
|
396
|
+
VALUE
|
397
|
+
workbook_max_url_length_(VALUE self) {
|
398
|
+
struct workbook *ptr;
|
399
|
+
Data_Get_Struct(self, struct workbook, ptr);
|
400
|
+
return INT2NUM(ptr->workbook->max_url_length);
|
401
|
+
}
|
402
|
+
|
403
|
+
/* call-seq: wb.max_url_length = 255
|
404
|
+
*/
|
405
|
+
VALUE
|
406
|
+
workbook_max_url_length_set_(VALUE self, VALUE value) {
|
407
|
+
struct workbook *ptr;
|
408
|
+
|
409
|
+
Data_Get_Struct(self, struct workbook, ptr);
|
410
|
+
|
411
|
+
ptr->workbook->max_url_length = NUM2INT(value);
|
412
|
+
|
413
|
+
return value;
|
414
|
+
}
|
415
|
+
|
416
|
+
/* call-seq:
|
417
|
+
* wb.sst.string_count -> 0
|
418
|
+
*
|
419
|
+
* Returns special accessor object for shared strings table.
|
420
|
+
*/
|
421
|
+
VALUE
|
422
|
+
workbook_sst_(VALUE self) {
|
423
|
+
struct workbook *ptr;
|
424
|
+
|
425
|
+
Data_Get_Struct(self, struct workbook, ptr);
|
426
|
+
|
427
|
+
return alloc_shared_strings_table_by_ref(ptr->workbook->sst);
|
428
|
+
}
|
429
|
+
|
355
430
|
/* call-seq:
|
356
431
|
* wb.validate_sheet_name(name) -> true
|
357
432
|
* wb.validate_worksheet_name(name) -> true
|
@@ -362,11 +437,7 @@ workbook_define_name_(VALUE self, VALUE name, VALUE formula) {
|
|
362
437
|
*/
|
363
438
|
VALUE
|
364
439
|
workbook_validate_sheet_name_(VALUE self, VALUE name) {
|
365
|
-
|
366
|
-
lxw_error err;
|
367
|
-
Data_Get_Struct(self, struct workbook, ptr);
|
368
|
-
err = workbook_validate_sheet_name(ptr->workbook, StringValueCStr(name));
|
369
|
-
handle_lxw_error(err);
|
440
|
+
LXW_ERR_RESULT_CALL(workbook, validate_sheet_name, StringValueCStr(name));
|
370
441
|
return Qtrue;
|
371
442
|
}
|
372
443
|
|
@@ -428,12 +499,17 @@ init_xlsxwriter_workbook() {
|
|
428
499
|
rb_define_method(cWorkbook, "add_format", workbook_add_format_, 2);
|
429
500
|
rb_define_method(cWorkbook, "add_vba_project", workbook_add_vba_project_, 1);
|
430
501
|
rb_define_method(cWorkbook, "add_worksheet", workbook_add_worksheet_, -1);
|
502
|
+
rb_define_method(cWorkbook, "add_chartsheet", workbook_add_chartsheet_, -1);
|
431
503
|
rb_define_method(cWorkbook, "define_name", workbook_define_name_, 2);
|
432
504
|
rb_define_method(cWorkbook, "properties", workbook_properties_, 0);
|
433
505
|
rb_define_method(cWorkbook, "set_default_xf_indices", workbook_set_default_xf_indices_, 0);
|
506
|
+
rb_define_method(cWorkbook, "unset_default_url_format", workbook_unset_default_url_format_, 0);
|
434
507
|
rb_define_method(cWorkbook, "validate_sheet_name", workbook_validate_sheet_name_, 1);
|
435
508
|
rb_define_method(cWorkbook, "validate_worksheet_name", workbook_validate_sheet_name_, 1);
|
436
509
|
rb_define_method(cWorkbook, "vba_name=", workbook_set_vba_name_, 1);
|
510
|
+
rb_define_method(cWorkbook, "max_url_length", workbook_max_url_length_, 0);
|
511
|
+
rb_define_method(cWorkbook, "max_url_length=", workbook_max_url_length_set_, 1);
|
512
|
+
rb_define_method(cWorkbook, "sst", workbook_sst_, 0);
|
437
513
|
|
438
514
|
/*
|
439
515
|
* This attribute contains effective font widths used for automatic column
|