Comments (7)
Borders can be removed but this is not via the style
prop.
You can toggle this on the TableHeader
, TableBody
, TableCell
and DataTableCell
components using the following props includeLeftBorder
, includeTopBorder
, includeRightBorder
and includeBottomBorder
. Refer to this documentation: https://github.com/dmk99/react-pdf-table/blob/master/docs/typedoc/interfaces/_tablecell_.tableborder.md
You can specify the border display in the top-level containers TableHeader
and TableBody
, these options should then be passed to all children components.
There is a bug when disabling the borders though, which I've just found. The right border directive is ignored if you choose not to display borders.
from react-pdf-table.
Hello, can we remove the border table with props style? I tried but not work.
<Table style={{border:"none"}} data={[ {firstName: "John", lastName: "Smith", dob: new Date(2000, 1, 1), country: "Australia", phoneNumber: "xxx-0000-0000"}, {firstName: "John", lastName: "Smith", dob: new Date(2000, 1, 1), country: "Australia", phoneNumber: "xxx-0000-0000"}, {firstName: "John", lastName: "Smith", dob: new Date(2000, 1, 1), country: "Australia", phoneNumber: "xxx-0000-0000"}, ]} > <TableHeader styles={{border:"none"}}> <TableCell style={{border:"none", color:"red",includeTopBorder:false,includeBottomBorder:false,includeLeftBorder:false,includeRightBorder:false}} > First Name </TableCell> <TableCell> Last Name </TableCell> <TableCell> DOB </TableCell> <TableCell> Country </TableCell> <TableCell> Phone Number </TableCell> </TableHeader> <TableBody styles={{border:"none"}}> <DataTableCell getContent={(r) => <Link src="https://www.google.com">{r.firstName}</Link> }/> <DataTableCell getContent={(r) => r.lastName}/> <DataTableCell getContent={(r) => r.dob.toLocaleString()}/> <DataTableCell getContent={(r) => r.country}/> <DataTableCell getContent={(r) => r.phoneNumber}/> </TableBody> </Table>
An alternative that I found was the following:
in the file "TableCell.js" in the module's lib folder, comment out line 49.
var defaultStyle = {
flex: (_a = this.props.weighting, (_a !== null && _a !== void 0 ? _a : 1)),
justifyContent: "stretch",
textAlign: (_b = this.props.textAlign, (_b !== null && _b !== void 0 ? _b : "left")),
fontSize: (_c = this.props.fontSize, (_c !== null && _c !== void 0 ? _c : (this.props.isHeader === true ? 14 : 12))),
// borderRight: includeRightBorder && "1pt solid black",
wordWrap: "break-word",
whiteSpace: "pre-wrap"
};
from react-pdf-table.
Hi, i tried using includeLeftBorder, includeTopBorder, includeRightBorder and includeBottomBorder for TableBody but borderTop still appears.
<Table data={dataTotal}>
<TableBody
includeBottomBorder={false}
includeLeftBorder={false}
includeRightBorder={false}
includeTopBorder={false}
>
<DataTableCell
style={stylesPDF.borderTopNone}
weighting={0.8}
getContent={(r) => (
<Text style={[stylesPDF.textRight, stylesPDF.fs11, stylesPDF.pd3]}>{r.name}</Text>
)}
/>
<DataTableCell
style={stylesPDF.borderTopNone}
weighting={0.2}
getContent={(r) => (
<Text style={[stylesPDF.textRight, stylesPDF.fs11, stylesPDF.pd3]}>
{formatCurrency(r.value)}
</Text>
)}
/>
</TableBody>
</Table>
from react-pdf-table.
i found that when i check file TableBody.js line 39 and 41. did you forget the condition of includeTopBoder?
var TableBody = (function (_super) {
__extends(TableBody, _super);
function TableBody() {
return _super !== null && _super.apply(this, arguments) || this;
}
TableBody.prototype.render = function () {
var _this = this;
var _a;
var rowCells = React.Children.toArray(this.props.children);
var _b = Utils_1.getDefaultBorderIncludes(this.props), includeLeftBorder = _b.includeLeftBorder, includeBottomBorder = _b.includeBottomBorder, includeRightBorder = _b.includeRightBorder;
var dataRows = (_a = this.props.data, (_a !== null && _a !== void 0 ? _a : []));
return ((dataRows).map(function (data, rowIndex) { return (React.createElement(TableRow_1.TableRow, __assign({}, _this.props, { key: rowIndex, data: data, includeLeftBorder: includeLeftBorder, includeBottomBorder: includeBottomBorder, includeRightBorder: includeRightBorder, includeTopBorder: false }), rowCells)); }));
};
return TableBody;
}(React.PureComponent));
from react-pdf-table.
You can toggle this on the TableHeader, TableBody, TableCell and DataTableCell components using the following props includeLeftBorder, includeTopBorder, includeRightBorder and includeBottomBorder. Refer to this documentation: https://github.com/dmk99/react-pdf-table/blob/master/docs/typedoc/interfaces/_tablecell_.tableborder.md
Hi, thanks for your pdf code:
please include this in the top-level documentation, it wasnt obvious that this was the setting to use to remove border on the table and in-hindsight its obvious after looking into the typescript .d.ts files, but spent some time to figure it out.
thanks though for replying to the issue!
from react-pdf-table.
I still seem to get a border for the rows (not sure if it is the top or the bottom).
from react-pdf-table.
Hi, i tried using includeLeftBorder, includeTopBorder, includeRightBorder and includeBottomBorder for TableBody but borderTop still appears.
<Table data={dataTotal}> <TableBody includeBottomBorder={false} includeLeftBorder={false} includeRightBorder={false} includeTopBorder={false} > <DataTableCell style={stylesPDF.borderTopNone} weighting={0.8} getContent={(r) => ( <Text style={[stylesPDF.textRight, stylesPDF.fs11, stylesPDF.pd3]}>{r.name}</Text> )} /> <DataTableCell style={stylesPDF.borderTopNone} weighting={0.2} getContent={(r) => ( <Text style={[stylesPDF.textRight, stylesPDF.fs11, stylesPDF.pd3]}> {formatCurrency(r.value)} </Text> )} /> </TableBody> </Table>
To remove all borders you need to install in TableHeader, TableBody:
includeBottomBorder={false}
includeLeftBorder={false}
includeRightBorder={false}
includeTopBorder={false}
And in TableCell, DataTableCell:
style={[{ border: "0px" }]}
<View>
<Table
data={[
{
firstName: "Iggarila",
lastName: "Smith",
dob: new Date(),
country: "Australia",
phoneNumber: "xxx-0000-0000",
},
]}
>
<TableHeader
textAlign={"center"}
includeBottomBorder={false}
includeLeftBorder={false}
includeRightBorder={false}
includeTopBorder={false}
>
<TableCell style={[{ border: "0px" }]}>
Name
</TableCell>
<TableCell style={[{ border: "0px" }]}>
Surname
</TableCell>
<TableCell style={[{ border: "0px" }]}>
Date
</TableCell>
<TableCell style={[{ border: "0px" }]}>
Location
</TableCell>
</TableHeader>
<TableBody
includeBottomBorder={false}
includeLeftBorder={false}
includeRightBorder={false}
includeTopBorder={false}
>
<DataTableCell getContent={(r) => r.firstName} style={[{ border: "0px" }]} />
<DataTableCell getContent={(r) => r.lastName} style={[{ border: "0px" }]} />
<DataTableCell getContent={(r) => r.dob.toLocaleString()} style={[{ border: "0pxk" }]} />
<DataTableCell getContent={(r) => r.country} style={[{ border: "0px" }]} />
</TableBody>
</Table>
</View>
from react-pdf-table.
Related Issues (20)
- Add yarn support HOT 1
- Table ignores padding of parent View. HOT 1
- Override width for a specific Row. HOT 1
- How to get row index? HOT 1
- How to merge cell HOT 1
- styling rows HOT 4
- TableCell and DataTableCell throws an error
- Can we achieve two tables side by sides in a single render HOT 1
- Can we add page breaks HOT 1
- Error when build the project
- Update peerDependencies HOT 6
- Request: Colspan And Rowspan
- need some description
- Possibility to set wrap on TableRow from code HOT 2
- I would like to know how to wrap this table?
- Support React 16, 17 and 18
- How to add header in every page?
- Consolidating react-pdf table packages HOT 2
- running into errors while installing HOT 1
- Error in Next js 13 App routes HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-pdf-table.