-
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
Impl <xdr:twoCellAnchor editAs=oneCell> #407
Merged
Merged
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
c7c2132
Impl <xdr:twoCellAnchor editAs=oneCell>
Ockejanssen 818c75b
EUDEV-7310 need Jenkins job, should run build before publish - adapted
ae5e3d4
EUDEV-7310 better be scoped - adapted
19204a6
Revert "EUDEV-7310 better be scoped - adapted"
dffc1cc
Revert "EUDEV-7310 need Jenkins job, should run build before publish …
6192fcb
add missing braces - fixed
Ockejanssen 7b43c68
add missing doc - fixed
Ockejanssen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next
Next commit
Impl <xdr:twoCellAnchor editAs=oneCell>
- Loading branch information
commit c7c213216c2047517e275d4c513bb7434bf8c805
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,7 +35,7 @@ utils.inherits(TwoCellAnchorXform, BaseXform, { | |
// Note - zero based | ||
model.tl = { | ||
col: range.left - 1, | ||
row: range.top - 1, | ||
row: range.top - 1 | ||
}; | ||
// zero based but also +1 to cover to bottom right of br cell | ||
model.br = { | ||
|
@@ -49,7 +49,12 @@ utils.inherits(TwoCellAnchorXform, BaseXform, { | |
}, | ||
|
||
render: function(xmlStream, model) { | ||
xmlStream.openNode(this.tag); | ||
if(model.range.editAs) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I know it's pedantic but could you add braces to this if statement |
||
xmlStream.openNode(this.tag, {editAs: model.range.editAs}); | ||
else | ||
xmlStream.openNode(this.tag); | ||
model.tl.editAsOneCell = model.range.editAs == 'oneCell'; | ||
model.br.editAsOneCell = model.range.editAs == 'oneCell'; | ||
|
||
this.map['xdr:from'].render(xmlStream, model.tl); | ||
this.map['xdr:to'].render(xmlStream, model.br); | ||
|
@@ -67,6 +72,9 @@ utils.inherits(TwoCellAnchorXform, BaseXform, { | |
switch (node.name) { | ||
case this.tag: | ||
this.reset(); | ||
this.model = { | ||
editAs: node.attributes['editAs'] | ||
}; | ||
break; | ||
default: | ||
this.parser = this.map[node.name]; | ||
|
@@ -93,11 +101,10 @@ utils.inherits(TwoCellAnchorXform, BaseXform, { | |
} | ||
switch (name) { | ||
case this.tag: | ||
this.model = { | ||
tl: this.map['xdr:from'].model, | ||
br: this.map['xdr:to'].model, | ||
picture: this.map['xdr:pic'].model, | ||
}; | ||
this.model = this.model || {}; | ||
this.model.tl = this.map['xdr:from'].model; | ||
this.model.br = this.map['xdr:to'].model; | ||
this.model.picture = this.map['xdr:pic'].model; | ||
return false; | ||
default: | ||
// could be some unrecognised tags | ||
|
@@ -121,6 +128,10 @@ utils.inherits(TwoCellAnchorXform, BaseXform, { | |
br: model.br, | ||
}; | ||
} | ||
if (model.editAs) { | ||
model.range.editAs = model.editAs; | ||
delete model.editAs; | ||
} | ||
delete model.tl; | ||
delete model.br; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
var fs = require('fs'); | ||
var path = require('path'); | ||
|
||
var HrStopwatch = require('./utils/hr-stopwatch'); | ||
|
||
var Workbook = require('../excel').Workbook; | ||
|
||
var filename = process.argv[2]; | ||
|
||
var wb = new Workbook(); | ||
var ws = wb.addWorksheet('blort'); | ||
|
||
var imageId = wb.addImage({ | ||
filename: path.join(__dirname, 'data/image2.png'), | ||
extension: 'png', | ||
}); | ||
ws.addImage(imageId, { | ||
tl: { col: 0.1125, row: 0.4 }, | ||
br: { col: 2.101046875, row: 3.4 }, | ||
editAs: 'oneCell' | ||
}); | ||
|
||
var stopwatch = new HrStopwatch(); | ||
stopwatch.start(); | ||
wb.xlsx.writeFile(filename) | ||
.then(function() { | ||
var micros = stopwatch.microseconds; | ||
console.log('Done.'); | ||
console.log('Time taken:', micros) | ||
}) | ||
.catch(function(error) { | ||
console.error(error.stack); | ||
}); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Shouldn't the same adjustment be done to col (above)?
Also - is there any adjustment required for the parse functions?
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.
I'll take a look at the parse function. About the col I don't know, I just looked into what OOo writes and did the same ;-)
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.
I've finally had some time to look into this. From what I can see (based on how Excel behaves) the row adjustment is not necessary, so I've removed it.