You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
async generateSaudiHealthCertSeafoodDocx(
query: HealthCertFoodDto,
sellerStaff: Staff,
) {
const PHONE_NUMBER = '07534563401';
const PROFILE_URL = 'https://www.linkedin.com/in/dolan1';
const EMAIL = 'docx@com';
try {
const pageWidth = 11908.8;
const marginSize = 720;
const displaySize = pageWidth - marginSize * 2;
const widthIndex = 720;
const borderNone: ITableCellBorders = {
top: { style: 'single', color: 'FFFFFF' },
bottom: { style: 'single', color: 'FFFFFF' },
left: { style: 'single', color: 'FFFFFF' },
right: { style: 'single', color: 'FFFFFF' },
};
const doc = new Document({
styles: {
paragraphStyles: [
{
id: 'normalPara',
name: 'Normal Para',
basedOn: 'Normal',
quickFormat: true,
run: {
font: 'Calibri',
size: 12,
},
paragraph: {
spacing: {
line: 240,
before: 0,
after: 0,
},
rightTabStop: TabStopPosition.MAX,
leftTabStop: 453.543307087,
},
},
{
id: 'boldPara',
name: 'Bold Para',
basedOn: 'Bold',
quickFormat: true,
run: {
font: 'Calibri',
size: 18,
bold: true,
},
paragraph: {
spacing: {
line: 240,
before: 0,
after: 0,
},
rightTabStop: TabStopPosition.MAX,
leftTabStop: 453.543307087,
},
},
],
},
sections: [
{
properties: {
page: {
margin: {
top: marginSize,
left: marginSize,
right: marginSize,
bottom: marginSize,
},
},
},
children: [
new Table({
columnWidths: [displaySize / 2, displaySize / 2],
rows: [
new TableRow({
children: [
new TableCell({
borders: borderNone,
children: [
new Paragraph({
children: [
new TextRun({
text: 'Health Certificate for Export of Products of Aquatic Animal Origin to the Kingdom of Saudi Arabia (KSA)',
color: 'FF0000',
}),
],
style: 'boldPara',
alignment: AlignmentType.CENTER,
}),
],
}),
new TableCell({
borders: borderNone,
children: [
new Paragraph({
children: [
new TextRun({
text: 'الشهادة صحية لتصدير املنتجات البحرية ذات أصل حيواني إلى اململكة العربية السعودية',
color: 'FF0000',
}),
],
style: 'boldPara',
alignment: AlignmentType.CENTER,
bidirectional: true,
}),
],
}),
],
}),
],
}),
new Table({
columnWidths: [
widthIndex,
displaySize / 2 - widthIndex,
widthIndex,
displaySize / 2 - widthIndex,
],
rows: [
new TableRow({
children: [
new TableCell({
children: [
new Paragraph({
text: 'I.1',
style: 'boldPara',
}),
],
}),
new TableCell({
children: [
new Table({
rows: [
new TableRow({
children: [],
}),
],
}),
new Paragraph({
children: [
new TextRun({
text: 'Consignor (Exporter)',
}),
new TextRun({
text: '\t', // Khoảng cách giữa các đoạn văn
}),
new TextRun({
text: 'المرسل (المصدر)',
}),
],
style: 'boldPara',
}),
],
}),
new TableCell({
children: [
new Paragraph({
text: 'I.2',
style: 'boldPara',
}),
],
}),
new TableCell({
children: [
new Paragraph({
text: 'Certificate Reference No.',
style: 'boldPara',
}),
],
}),
],
}),
],
}),
],
},
],
});
const file = await Packer.toBuffer(doc);
return file;
} catch (error) {
console.error('Error generating document:', error);
throw new Error('Document generation failed');
}
}`
new TableCell({
children: [
new Table({
rows: [
new TableRow({
children: [],
}),
],
}),
new Paragraph({
children: [
new TextRun({
text: 'Consignor (Exporter)',
}),
new TextRun({
text: '\t', // Khoảng cách giữa các đoạn văn
}),
new TextRun({
text: 'المرسل (المصدر)',
}),
],
style: 'boldPara',
}),
],
}),
The internal tableCell seems to be malfunctioning and it has lost all the structure of a table.
Thank you for raising an issue to docx
Please do not raise an issue unless it is an issue.
Is your issue a feature request? Are you giving ideas to the community? Are you asking for help? Please raise a ticket in the Discussions section:
The internal tableCell seems to be malfunctioning and it has lost all the structure of a table.
Thank you for raising an issue to
docx
Please do not raise an issue unless it is an issue.
Is your issue a feature request? Are you giving ideas to the community? Are you asking for help? Please raise a ticket in the
Discussions
section:https://github.com/dolanmiu/docx/discussions
Is your issue a previously asked? Please respond to that thread instead
The text was updated successfully, but these errors were encountered: