Giter VIP home page Giter VIP logo

Comments (3)

gino8080 avatar gino8080 commented on July 29, 2024 2

I just tried using style and it worked

simple example:

export const PdfTable = () => {

  const style = { padding: 5 }
  return (
    <Table
      data={[
        { firstName: "John", lastName: "Smith", dob: new Date(2000, 1, 1), country: "Australia", phoneNumber: "xxx-0000-0000" }
      ]}
    >
      <TableHeader>
        <TableCell style={style}> First Name   </TableCell>
        <TableCell style={style}> Last Name </TableCell>
        <TableCell style={style}> DOB </TableCell>
        <TableCell style={style}> Country  </TableCell>
        <TableCell style={style}> Phone Number  </TableCell>
      </TableHeader>
      <TableBody>
        <DataTableCell getContent={(r) => r.firstName} style={style} />
        <DataTableCell getContent={(r) => r.lastName} style={style} />
        <DataTableCell getContent={(r) => r.dob.toLocaleString()} style={style} />
        <DataTableCell getContent={(r) => r.country} style={style} />
        <DataTableCell getContent={(r) => r.phoneNumber} style={style} />
      </TableBody>
    </Table>
  )
}

from react-pdf-table.

akosijiji avatar akosijiji commented on July 29, 2024

@gino8080 thanks for this. How about <DataTableCell>?

Edit: I've tried also adding the style to TableCell but it didn't work.

from react-pdf-table.

dmk99 avatar dmk99 commented on July 29, 2024

Are you using version 0.1.* of the library? If you are the style property needs to be styles.
In version 0.3.0 this has changed to style as above. This was to align with ReactPDF property names.

I'd recommend upgrading to 0.3.*

from react-pdf-table.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.