-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Supports setting cell comment properties #1159
Conversation
@Alanscut, many changes are here, should we make a review session through zoom.us? |
@Siemienik Sorry for replying so late. I am looking forward to video communication with you, but English is not my native language, video communication will be very difficult for me. I would rather explain my purpose and plan in writing, hope you not mind. Purpose:excel.js currently only supports inserting annotations, but does not allow users to set the corresponding properties of annotations. This PR is to solve this problem. Code:This PR will support setting protection, margin and object position attributes. I also want to support font, alignment, size and color and line attributes, so that users can insert comments flexibly.
This PR is a new feature and will not affect the original function, and all test cases are successful. Democonst Excel = require('../../lib/exceljs.nodejs');
const workbook = new Excel.Workbook();
const ws2 = workbook.addWorksheet('sheet1');
ws2.getCell('A1').value = 'Hello';
ws2.getCell('A1').note = 'Hello, ExcelJS!';
ws2.getCell('A5').value = 'world';
ws2.getCell('A5').note = {
texts: [{
'font': {
'size': 12,
'color': {
'theme': 0,
},
'name': 'Calibri',
'family': 2,
'scheme': 'minor',
},
'text': 'hello exceljs',
}],
margins: {
insetmode: 'custom',
inset: [0.55, 0.55, 0.45, 0.45],
},
protection: {
locked: 'True',
lockText: 'True',
},
editAs: 'absolute',
};
const fileName1 = './read/issue_comments_padding.xlsx';
workbook.xlsx.writeFile(fileName1).then(() => {
console.log('ok');
}); XML// vmlDrawing1.vml
<v:shape id="_x0000_s1026" type="#_x0000_t202" style="position:absolute; margin-left:105.3pt;margin-top:10.5pt;width:97.8pt;height:59.1pt;z-index:1;visibility:hidden" fillcolor="infoBackground [80]" strokecolor="none [81]" o:insetmode="custom">
<v:fill color2="infoBackground [80]" />
<v:shadow color="none [81]" obscured="t" />
<v:path o:connecttype="none" />
<v:textbox style="mso-direction-alt:auto" inset="5.5mm,5.5mm,4.5mm,4.5mm">
<div style="text-align:left" />
</v:textbox>
<x:ClientData ObjectType="Note">
<x:MoveWithCells />
<x:SizeWithCells />
<x:Anchor>1, 6, 3, 14, 3, 2, 7, 16</x:Anchor>
<x:Locked>True</x:Locked>
<x:AutoFill>False</x:AutoFill>
<x:LockText>True</x:LockText>
<x:Row>4</x:Row>
<x:Column>0</x:Column>
</x:ClientData>
</v:shape> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @Alanscut. I've just reviewed it deeply and have only one comment here:)
ae3b114
to
1927396
Compare
@Siemienik what do you think? |
changes