function make_html_pdf_table($test_link_to_css_js = false) { define("GOOGLE_DOCS_BOOK_SPREADSHEET", "https://docs.google.com/spreadsheets/d/12L1xoLC38ypaxB77jKUgLSX3MBmaxmIRaHhV2XVeh0o/export?format=csv&id"); $pdf_table = new PdfTable(GOOGLE_DOCS_BOOK_SPREADSHEET); $at_least_100_books = 100; $is_user_logged_in = is_user_logged_in(); // WordPress function $pdf_table->readCurrentPdfData($at_least_100_books, $is_user_logged_in); // only check for new books if signed into WordPress, and there must be at least 100 books in the spreadsheet to update $html_with_javascript = $pdf_table->addJavascript($test_link_to_css_js); return $html_with_javascript; }
public function testSpecialChars() { $at_least_1_book = 1; $pdf_table = new PdfTable(__DIR__ . '/test_special_chars_start.csv'); $rows_only_html_bom = $pdf_table->readCurrentPdfData($at_least_1_book, true); $rows_only_html = Helpers::stripUtf8Bom($rows_only_html_bom); $expected_html_bom = file_get_contents(__DIR__ . '/test_special_chars_end.html'); $expected_html = Helpers::stripUtf8Bom($expected_html_bom); $this->assertEquals($expected_html, $rows_only_html); }
$this->Cell($w[$i], 7, $header[$i], 1, 0, 'C', 1); } $this->Ln(); //Restauración de colores y fuentes $this->SetFillColor(224, 235, 255); $this->SetTextColor(0); $this->SetFont(''); //Datos $fill = false; foreach ($data as $row) { foreach ($w as $k => $col) { $this->Cell($col, 6, $row[$k], 'LR', 0, 'L', $fill); } $this->Ln(); $fill = !$fill; } $this->Cell(array_sum($w), 0, '', 'T'); } } //instanciamos la clase $pdf = new PdfTable(); //TÃtulos de las columnas $header = array('Nombre', 'E-Mail', 'Twitter'); //anchos de cada columna $widths = array(40, 70, 40); //Carga de datos $data = array(array("Juan", "*****@*****.**", "@jperez"), array("Mario", "*****@*****.**", "@mariom"), array("Luis", "*****@*****.**", "@luisluis"), array("Javier", "*****@*****.**", "@xavierx")); $pdf->SetFont('Arial', '', 14); $pdf->AddPage(); $pdf->FancyTable($header, $data, $widths); $pdf->Output();