-
Notifications
You must be signed in to change notification settings - Fork 636
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
DYN-1819 ExportExcel Write as String Option #11291
DYN-1819 ExportExcel Write as String Option #11291
Conversation
Hi @StudioLE . Could you please add a unit test for this? Edit: For reference, here is the file where we have the unit tests related to Excel: https://github.com/DynamoDS/Dynamo/blob/master/test/Libraries/DynamoMSOfficeTests/ExcelTests.cs |
I don't think these changes are allowed in terms of API compatability... see: ❌ DISALLOWED: Adding, removing, or changing the order of parameters while this might work pretty well for nodes - I don't think it will work for c# code that calls this code. |
@mjkkirschner Right, but this PR is doing what's described in the ticket. Could it be that we didn't consider this part of our API or disregarded the compatibility break? Copying @Amoursol |
I had indeed not been aware of the compatibility break - assumed that adding a new node port (As we have done in other cases?) would be acceptable and a non-breaking change if default values adhered to existing graph conditions. @mjkkirschner - What kind of issues will arise from this in a non-node basis, assuming my above assertions are correct? |
code which calls this node from c# will throw a What should likely be done is to:
|
it may make sense to use the migrations.xml file instead since theres already an existing one for dsoffice assembly: Either of these migration options will need manual and automated testing. |
@StudioLE Based on the comments made by @mjkkirschner , could we ask you to change the contribution to use a new node/function so that we can remain backwards compatible? Thank you |
Hi guys, im looking into getting this wrapped up, Sorry for the delay! Im having some issues getting the migrations to work. I tried the following:
<priorNameHint>
<oldName>DSOffice.Data.ExportExcel</oldName>
<newName>DSOffice.Data.ExportExcelWithStringParameter</newName>
</priorNameHint>
Is there something im doing wrong here, it dosent really work at least. When i open a graph using the old |
Hi @SHKnudsen . I'm not familiar with the migrations but maybe @mjkkirschner and @aparajit-pratap can chime in? |
@SHKnudsen could you also try including the list of parameters with both node names in the migrations.xml file since the new node also has an additional parameter. Refer to this for an example:
|
@SHKnudsen @StudioLE - for now can you try the following:
|
@mjkkirschner done. Called the node |
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.
@SHKnudsen thanks! You'll need to do one last thing - add an entry for the new node to the libraryItems.json
file so that the remaining failing test passes. See: https://github.com/DynamoDS/Dynamo/wiki/Adding-or-Updating-Built-In-Library-Icons#step-5-update-testing-resources
This reverts commit 0ddd62d.
iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAABl0RVh0U29m | ||
dHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAABMSURBVFhH7dCxCQAgDETRTCuO4Gwup5YpzkKuMfAf | ||
pPmFcAYA4GbMvvK57Zl6xGl4dr6u5XNbPWqF0+pRK5xWj1rhtHrUCqcBwKciNnx+8yHggVbjAAAAAElF | ||
TkSuQmCC |
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.
Did this icon change?
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 had to rename the icon. Guess thats whats triggering the change?
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.
It could be some randomness in the resx
file introduced by Visual Studio, but it is strange because this is another icon, not the one that was renamed.
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.
Oh right, hmm that is strange. Not even sure what this icon is used for, there is only a Small
version of it
xeDuk3//vu9nyGkkgJc832/yXdf8GTP0iWb3zoUWlxPLyEMb9wetSfDa9u+J/tm0YxIMrYh2w0I6YPIw | ||
J/mbonv8D7zpnw8R+16TMAsWlk+Gvzl7yLn8Oxp6xHyahHljgWsS5o0FrkmYNxa4JmHeWOCahHljgWsS | ||
5o0FrkmYNxZ4nASdnH1uLPRmEhT+vPBJwEchhBBCCCGEEEIIIYQQQgghxBSsrHwC4O+ISk6Usf4AAAAA | ||
SUVORK5CYII= |
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.
The content for this one looks different too. Is that expected?
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.
Yea not sure whats going on here, haven't touched this either
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 checked and in Dynamo the icons of the node look ok, so this is harmless.
src/Libraries/DSOffice/Excel.cs
Outdated
/// <returns name="data">Data written to the spreadsheet.</returns> | ||
/// <search>office,excel,spreadsheet</search> | ||
[IsVisibleInDynamoLibrary(false)] | ||
public static object[][] WriteToFile(string filePath, string sheetName, int startRow, int startCol, object[][] data, bool overWrite = false) | ||
public static object[][] WriteToFile(string filePath, string sheetName, int startRow, int startCol, object[][] data, bool overWrite = false, bool writeAsString = false) |
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.
This function is having a binary breaking change because optional parameters are a compile-time feature. Can we use an overload instead?
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.
Sorry, hadnt realized this was public too, will fix that.
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.
This new method doesn't need to be public. This logic can actually be folded into the new ExportToExcel
node and you can remove this method entirely. The only reason there existed an old WriteToFile
method was that it was originally a node, which was later renamed to ExportExcel
.
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.
So one thing before i make this change. Would you prefer to have one private method that WriteToFile
and ExportToExcel
uses? other option would be to duplicate the logic from WriteToFile
into ExportToExcel
with the additional parameter.
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 think option 1 sounds good. I'd rather not duplicate the code if possible.
</data> | ||
<data name="DSOffice.Data.ExportExcel.Small" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> | ||
<data name="DSOffice.Data.ExportToExcel.Small" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> |
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.
Since we are not doing the migration yet, I think we should keep the icon for the old node too, rather than replace it.
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.
Okay, but we still use the same icon for both right?
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.
Yes, that should be fine.
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.
Looks good to me
xeDuk3//vu9nyGkkgJc832/yXdf8GTP0iWb3zoUWlxPLyEMb9wetSfDa9u+J/tm0YxIMrYh2w0I6YPIw | ||
J/mbonv8D7zpnw8R+16TMAsWlk+Gvzl7yLn8Oxp6xHyahHljgWsS5o0FrkmYNxa4JmHeWOCahHljgWsS | ||
5o0FrkmYNxZ4nASdnH1uLPRmEhT+vPBJwEchhBBCCCGEEEIIIYQQQgghxBSsrHwC4O+ISk6Usf4AAAAA | ||
SUVORK5CYII= |
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 checked and in Dynamo the icons of the node look ok, so this is harmless.
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.
One last comment about the redundancy of the new WriteToFile
method.
@aparajit-pratap Could I ask you take one final look here? If you are ok with the last change I think we are good to merge. |
src/Libraries/DSOffice/Excel.cs
Outdated
@@ -864,7 +845,7 @@ public static object[][] ImportExcel(FileInfo file, string sheetName, bool readA | |||
|
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.
Is there a line white space here? Can we delete this?
@mmisol are we going to add any tests or have Sylvester add tests? |
Good point @aparajit-pratap . I didn't realize we didn't have them. Could you take care of adding one @SHKnudsen ? |
Yes sorry guys, actually thought there was tests on this one. Ill have a look at it now. |
Thanks @SHKnudsen . I'll wait for self serve and merge. |
"Nodes": [ | ||
{ | ||
"ConcreteType": "CoreNodeModels.Input.Filename, CoreNodeModels", | ||
"HintPath": "C:\\Users\\SylvesterKnudsen\\Documents\\GitHub\\StudioLEDynamo\\test\\core\\excel\\WriteFile.xlsx", |
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 think we missed this during the PR review.. Not sure how self CI passed with this...
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.
@QilongTang Now that you mention it, I think @alfredo-pozo said ExcelTests
are not run in self-serve CI. This is my bad, sorry for forgetting.
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.
@QilongTang @mmisol - the weird part is why did we not get a master-15 job until today that contained this code?
Purpose
JIRA: DYN-1819
Issues: DynamoDS/DynamoWishlist#13
Added an additional
writeAsString
parameter to theData.ExportExcel
node. This parameter defaults tofalse
ensuring the existing behaviour is preserved. When set totrue
the NumberFormat for the written range is set totext
, therefore preserving the string rather than letting Excel automatically determine the format.Behaviour before:
Behaviour after
writeAsString: false
:Behaviour after
writeAsString: true
:Declarations
Check these if you believe they are true
*.resx
filesReviewers
@mjkkirschner @QilongTang @mmisol
FYIs
@Amoursol