javascript - 更新打字稿角度中单独行中的位置表字段以导出pdf
问题描述
我正在尝试以角度创建一个pdf文件。一切正常,我只是在某一点上卡住了。下表中是 order.orderItems.map 对象的值。价值观是应该的。我只想将我用黄色绘制的字段作为当前值上方的一条线。它应该像第二张图片它是可能的,但我不能这样做。我的代码如下;
async generatePDF(action = 'download', id: number) {
this.currentUser$ = this.accountService.currentUser$;
var order = this.orders.find(o => o.id === id);
this.currentUser$.pipe(take(1)).subscribe(
value => this.user = value);
let docDefinition = {
content: [
{
text: '',
style: 'sectionHeader'
},
{
columns: [
[
{
text: `Order Date: ${new Date(order.orderDate).toLocaleString()}`,
alignment: 'right'
},
{
text: `Order No : "${((order.id).toFixed(0))}"`,
alignment: 'right'
}
]
]
},
{
text: '',
style: 'sectionHeader'
},
{
text: 'Sayın' + ' ' + this.user.displayName + ' ,\n\n' +
' here is some text \n\n' +
'here is some text,\n' +
'here is some text'
,
margin: [0, 0, 0, 15]
},
{
text: 'Vehicle List',
style: 'sectionHeader',
},
{
table: {
headerRows: 1,
widths: ['auto', 'auto', 'auto', 'auto', 'auto', 'auto', 'auto', 'auto', 'auto'],
body: [
[
'',
'Status',
'Time',
'Km',
'Rent Cost',
'Over Km Cost',
'Gear Type',
'Fuel Type',
'Quantity',
],
...order.orderItems.map(p => {
return [
[p.productName + ' ' + p.productModel + ' ' + p.productVersion + ' ' + p.productModelYear],
(p.vehicleKm) ? (p.productType + ' ' + "(" + p.vehicleKm + " KM)") : p.productType,
p.rentMonth,
p.rentKm,
(p.additionalProfit * p.quantity).toFixed(2) + 'TL',
p.overKmPrice,
p.productGearType,
p.productFuelType,
p.quantity
]
})
]
}
}
解决方案
推荐阅读
- c - 从字节检查偶校验
- python - 使用 Python 和 Regex 从 JSON 中的文本中删除双引号
- java - RandomAccessFile 在特定行修改字符串
- pentaho - 如何使用 Pentaho 报表设计器在不同的子报表之间共享查询数据?
- c++ - Qt5 未注册触摸事件
- r - 使用 HTML 小部件创建 Xaringan HTML 演示文稿,并在附加或上传 HTML 文件时保留小部件和格式
- android - 如何从在单个键中具有多个值的共享首选项中删除单个值
- reactjs - 如何在我的布局组件之外呈现组件(主页)?
- php - 如何通过使用 Facebook-business-php-sdk 调用 Facebook 市场 API 返回特定用户的所有营销活动信息
- html - HTML 和 XHTML 有什么区别?