480
480
end
481
481
482
482
describe '#html_strings' do
483
- let ( :path ) { 'test/files/html_strings_formatting.xlsx' }
484
-
485
- it 'returns the expected result' do
486
- expect ( subject . excelx_value ( 1 , 1 , "Sheet1" ) ) . to eq "This has no formatting."
487
- expect ( subject . excelx_value ( 2 , 1 , "Sheet1" ) ) . to eq "<html>This has<b> bold </b>formatting.</html>"
488
- expect ( subject . excelx_value ( 2 , 2 , "Sheet1" ) ) . to eq "<html>This has <i>italics</i> formatting.</html>"
489
- expect ( subject . excelx_value ( 2 , 3 , "Sheet1" ) ) . to eq "<html>This has <u>underline</u> format.</html>"
490
- expect ( subject . excelx_value ( 2 , 4 , "Sheet1" ) ) . to eq "<html>Superscript. x<sup>123</sup></html>"
491
- expect ( subject . excelx_value ( 2 , 5 , "Sheet1" ) ) . to eq "<html>SubScript. T<sub>j</sub></html>"
492
-
493
- expect ( subject . excelx_value ( 3 , 1 , "Sheet1" ) ) . to eq "<html>Bold, italics <b><i>together</i></b>.</html>"
494
- expect ( subject . excelx_value ( 3 , 2 , "Sheet1" ) ) . to eq "<html>Bold, Underline <b><u>together</u></b>.</html>"
495
- expect ( subject . excelx_value ( 3 , 3 , "Sheet1" ) ) . to eq "<html>Bold, Superscript. <b>x</b><sup><b>N</b></sup></html>"
496
- expect ( subject . excelx_value ( 3 , 4 , "Sheet1" ) ) . to eq "<html>Bold, Subscript. <b>T</b><sub><b>abc</b></sub></html>"
497
- expect ( subject . excelx_value ( 3 , 5 , "Sheet1" ) ) . to eq "<html>Italics, Underline <i><u>together</u></i>.</html>"
498
- expect ( subject . excelx_value ( 3 , 6 , "Sheet1" ) ) . to eq "<html>Italics, Superscript. <i>X</i><sup><i>abc</i></sup></html>"
499
- expect ( subject . excelx_value ( 3 , 7 , "Sheet1" ) ) . to eq "<html>Italics, Subscript. <i>B</i><sub><i>efg</i></sub></html>"
500
- expect ( subject . excelx_value ( 4 , 1 , "Sheet1" ) ) . to eq "<html>Bold, italics underline,<b><i><u> together</u></i></b>.</html>"
501
- expect ( subject . excelx_value ( 4 , 2 , "Sheet1" ) ) . to eq "<html>Bold, italics, superscript. <b>X</b><sup><b><i>abc</i></b></sup><b><i>123</i></b></html>"
502
- expect ( subject . excelx_value ( 4 , 3 , "Sheet1" ) ) . to eq "<html>Bold, Italics, subscript. <b><i>Mg</i></b><sub><b><i>ha</i></b></sub><b><i>2</i></b></html>"
503
- expect ( subject . excelx_value ( 4 , 4 , "Sheet1" ) ) . to eq "<html>Bold, Underline, superscript. <b><u>AB</u></b><sup><b><u>C12</u></b></sup><b><u>3</u></b></html>"
504
- expect ( subject . excelx_value ( 4 , 5 , "Sheet1" ) ) . to eq "<html>Bold, Underline, subscript. <b><u>Good</u></b><sub><b><u>XYZ</u></b></sub></html>"
505
- expect ( subject . excelx_value ( 4 , 6 , "Sheet1" ) ) . to eq "<html>Italics, Underline, superscript. <i><u>Up</u></i><sup><i><u>swing</u></i></sup></html>"
506
- expect ( subject . excelx_value ( 4 , 7 , "Sheet1" ) ) . to eq "<html>Italics, Underline, subscript. <i><u>T</u></i><sub><i><u>swing</u></i></sub></html>"
507
- expect ( subject . excelx_value ( 5 , 1 , "Sheet1" ) ) . to eq "<html>Bold, italics, underline, superscript. <b><i><u>GHJK</u></i></b><sup><b><i><u>190</u></i></b></sup><b><i><u>4</u></i></b></html>"
508
- expect ( subject . excelx_value ( 5 , 2 , "Sheet1" ) ) . to eq "<html>Bold, italics, underline, subscript. <b><i><u>Mike</u></i></b><sub><b><i><u>drop</u></i></b></sub></html>"
509
- expect ( subject . excelx_value ( 6 , 1 , "Sheet1" ) ) . to eq "See that regular html tags do not create html tags.\n <ol>\n <li> Denver Broncos </li>\n <li> Carolina Panthers </li>\n <li> New England Patriots</li>\n <li>Arizona Panthers</li>\n </ol>"
510
- expect ( subject . excelx_value ( 7 , 1 , "Sheet1" ) ) . to eq "<html>Does create html tags when formatting is used..\n <ol>\n <li> <b>Denver Broncos</b> </li>\n <li> <i>Carolina Panthers </i></li>\n <li> <u>New England Patriots</u></li>\n <li>Arizona Panthers</li>\n </ol></html>"
483
+ describe "HTML Parsing Enabling" do
484
+ let ( :path ) { 'test/files/html_strings_formatting.xlsx' }
485
+
486
+ it 'returns the expected result' do
487
+ expect ( subject . excelx_value ( 1 , 1 , "Sheet1" ) ) . to eq ( "This has no formatting." )
488
+ expect ( subject . excelx_value ( 2 , 1 , "Sheet1" ) ) . to eq ( "<html>This has<b> bold </b>formatting.</html>" )
489
+ expect ( subject . excelx_value ( 2 , 2 , "Sheet1" ) ) . to eq ( "<html>This has <i>italics</i> formatting.</html>" )
490
+ expect ( subject . excelx_value ( 2 , 3 , "Sheet1" ) ) . to eq ( "<html>This has <u>underline</u> format.</html>" )
491
+ expect ( subject . excelx_value ( 2 , 4 , "Sheet1" ) ) . to eq ( "<html>Superscript. x<sup>123</sup></html>" )
492
+ expect ( subject . excelx_value ( 2 , 5 , "Sheet1" ) ) . to eq ( "<html>SubScript. T<sub>j</sub></html>" )
493
+
494
+ expect ( subject . excelx_value ( 3 , 1 , "Sheet1" ) ) . to eq ( "<html>Bold, italics <b><i>together</i></b>.</html>" )
495
+ expect ( subject . excelx_value ( 3 , 2 , "Sheet1" ) ) . to eq ( "<html>Bold, Underline <b><u>together</u></b>.</html>" )
496
+ expect ( subject . excelx_value ( 3 , 3 , "Sheet1" ) ) . to eq ( "<html>Bold, Superscript. <b>x</b><sup><b>N</b></sup></html>" )
497
+ expect ( subject . excelx_value ( 3 , 4 , "Sheet1" ) ) . to eq ( "<html>Bold, Subscript. <b>T</b><sub><b>abc</b></sub></html>" )
498
+ expect ( subject . excelx_value ( 3 , 5 , "Sheet1" ) ) . to eq ( "<html>Italics, Underline <i><u>together</u></i>.</html>" )
499
+ expect ( subject . excelx_value ( 3 , 6 , "Sheet1" ) ) . to eq ( "<html>Italics, Superscript. <i>X</i><sup><i>abc</i></sup></html>" )
500
+ expect ( subject . excelx_value ( 3 , 7 , "Sheet1" ) ) . to eq ( "<html>Italics, Subscript. <i>B</i><sub><i>efg</i></sub></html>" )
501
+ expect ( subject . excelx_value ( 4 , 1 , "Sheet1" ) ) . to eq ( "<html>Bold, italics underline,<b><i><u> together</u></i></b>.</html>" )
502
+ expect ( subject . excelx_value ( 4 , 2 , "Sheet1" ) ) . to eq ( "<html>Bold, italics, superscript. <b>X</b><sup><b><i>abc</i></b></sup><b><i>123</i></b></html>" )
503
+ expect ( subject . excelx_value ( 4 , 3 , "Sheet1" ) ) . to eq ( "<html>Bold, Italics, subscript. <b><i>Mg</i></b><sub><b><i>ha</i></b></sub><b><i>2</i></b></html>" )
504
+ expect ( subject . excelx_value ( 4 , 4 , "Sheet1" ) ) . to eq ( "<html>Bold, Underline, superscript. <b><u>AB</u></b><sup><b><u>C12</u></b></sup><b><u>3</u></b></html>" )
505
+ expect ( subject . excelx_value ( 4 , 5 , "Sheet1" ) ) . to eq ( "<html>Bold, Underline, subscript. <b><u>Good</u></b><sub><b><u>XYZ</u></b></sub></html>" )
506
+ expect ( subject . excelx_value ( 4 , 6 , "Sheet1" ) ) . to eq ( "<html>Italics, Underline, superscript. <i><u>Up</u></i><sup><i><u>swing</u></i></sup></html>" )
507
+ expect ( subject . excelx_value ( 4 , 7 , "Sheet1" ) ) . to eq ( "<html>Italics, Underline, subscript. <i><u>T</u></i><sub><i><u>swing</u></i></sub></html>" )
508
+ expect ( subject . excelx_value ( 5 , 1 , "Sheet1" ) ) . to eq ( "<html>Bold, italics, underline, superscript. <b><i><u>GHJK</u></i></b><sup><b><i><u>190</u></i></b></sup><b><i><u>4</u></i></b></html>" )
509
+ expect ( subject . excelx_value ( 5 , 2 , "Sheet1" ) ) . to eq ( "<html>Bold, italics, underline, subscript. <b><i><u>Mike</u></i></b><sub><b><i><u>drop</u></i></b></sub></html>" )
510
+ expect ( subject . excelx_value ( 6 , 1 , "Sheet1" ) ) . to eq ( "See that regular html tags do not create html tags.\n <ol>\n <li> Denver Broncos </li>\n <li> Carolina Panthers </li>\n <li> New England Patriots</li>\n <li>Arizona Panthers</li>\n </ol>" )
511
+ expect ( subject . excelx_value ( 7 , 1 , "Sheet1" ) ) . to eq ( "<html>Does create html tags when formatting is used..\n <ol>\n <li> <b>Denver Broncos</b> </li>\n <li> <i>Carolina Panthers </i></li>\n <li> <u>New England Patriots</u></li>\n <li>Arizona Panthers</li>\n </ol></html>" )
512
+ end
511
513
end
512
514
end
513
515
535
537
end
536
538
end
537
539
end
540
+
541
+ describe 'Roo::Excelx with options set' do
542
+ subject ( :xlsx ) do
543
+ Roo ::Excelx . new ( path , disable_html_wrapper : true )
544
+ end
545
+
546
+ describe '#html_strings' do
547
+ describe "HTML Parsing Disabled" do
548
+ let ( :path ) { 'test/files/html_strings_formatting.xlsx' }
549
+
550
+ it 'returns the expected result' do
551
+ expect ( subject . excelx_value ( 1 , 1 , "Sheet1" ) ) . to eq ( "This has no formatting." )
552
+ expect ( subject . excelx_value ( 2 , 1 , "Sheet1" ) ) . to eq ( "This has bold formatting." )
553
+ expect ( subject . excelx_value ( 2 , 2 , "Sheet1" ) ) . to eq ( "This has italics formatting." )
554
+ expect ( subject . excelx_value ( 2 , 3 , "Sheet1" ) ) . to eq ( "This has underline format." )
555
+ expect ( subject . excelx_value ( 2 , 4 , "Sheet1" ) ) . to eq ( "Superscript. x123" )
556
+ expect ( subject . excelx_value ( 2 , 5 , "Sheet1" ) ) . to eq ( "SubScript. Tj" )
557
+
558
+ expect ( subject . excelx_value ( 3 , 1 , "Sheet1" ) ) . to eq ( "Bold, italics together." )
559
+ expect ( subject . excelx_value ( 3 , 2 , "Sheet1" ) ) . to eq ( "Bold, Underline together." )
560
+ expect ( subject . excelx_value ( 3 , 3 , "Sheet1" ) ) . to eq ( "Bold, Superscript. xN" )
561
+ expect ( subject . excelx_value ( 3 , 4 , "Sheet1" ) ) . to eq ( "Bold, Subscript. Tabc" )
562
+ expect ( subject . excelx_value ( 3 , 5 , "Sheet1" ) ) . to eq ( "Italics, Underline together." )
563
+ expect ( subject . excelx_value ( 3 , 6 , "Sheet1" ) ) . to eq ( "Italics, Superscript. Xabc" )
564
+ expect ( subject . excelx_value ( 3 , 7 , "Sheet1" ) ) . to eq ( "Italics, Subscript. Befg" )
565
+ expect ( subject . excelx_value ( 4 , 1 , "Sheet1" ) ) . to eq ( "Bold, italics underline, together." )
566
+ expect ( subject . excelx_value ( 4 , 2 , "Sheet1" ) ) . to eq ( "Bold, italics, superscript. Xabc123" )
567
+ expect ( subject . excelx_value ( 4 , 3 , "Sheet1" ) ) . to eq ( "Bold, Italics, subscript. Mgha2" )
568
+ expect ( subject . excelx_value ( 4 , 4 , "Sheet1" ) ) . to eq ( "Bold, Underline, superscript. ABC123" )
569
+ expect ( subject . excelx_value ( 4 , 5 , "Sheet1" ) ) . to eq ( "Bold, Underline, subscript. GoodXYZ" )
570
+ expect ( subject . excelx_value ( 4 , 6 , "Sheet1" ) ) . to eq ( "Italics, Underline, superscript. Upswing" )
571
+ expect ( subject . excelx_value ( 4 , 7 , "Sheet1" ) ) . to eq ( "Italics, Underline, subscript. Tswing" )
572
+ expect ( subject . excelx_value ( 5 , 1 , "Sheet1" ) ) . to eq ( "Bold, italics, underline, superscript. GHJK1904" )
573
+ expect ( subject . excelx_value ( 5 , 2 , "Sheet1" ) ) . to eq ( "Bold, italics, underline, subscript. Mikedrop" )
574
+ expect ( subject . excelx_value ( 6 , 1 , "Sheet1" ) ) . to eq ( "See that regular html tags do not create html tags.\n <ol>\n <li> Denver Broncos </li>\n <li> Carolina Panthers </li>\n <li> New England Patriots</li>\n <li>Arizona Panthers</li>\n </ol>" )
575
+ expect ( subject . excelx_value ( 7 , 1 , "Sheet1" ) ) . to eq ( "Does create html tags when formatting is used..\n <ol>\n <li> Denver Broncos </li>\n <li> Carolina Panthers </li>\n <li> New England Patriots</li>\n <li>Arizona Panthers</li>\n </ol>" )
576
+ end
577
+ end
578
+ end
579
+ end
0 commit comments