Window.print problem

Hi Guys,
I am using web grid on my page to show spreadsheet. On this page I have print button which call javascript function window.print(). But by calling this I am getting javascript error:

Microsoft JScript runtime error: Unable to get value of the property ‘currentStyle’: object is null or undefined

It looks like that webgrid override the print function so if I call window.print() it goes straight into acwmain.js file at line "var originalViewPanelOverflow=xViewPanel.currentStyle.overflow;"

Could you please help me to get ride this problem, I need to use window.print() function along with web grid on page.

Thanks,
Awais

Hi,

I think you may call the method provided by GridWeb i.e. GridWeb.print() on the client side (in JavaScript), see the demos on how to do the scripts on the client side:

And for your issue, could you create a sample project, zip it and post it here to show the issue, we will check it soon.

Thank you.

Thanks Amjad,
I have build the demo for you in which you can see the print button having javascript ‘window.print()’ which causing this problem.

Let me know if anything else you need.

Regards,
Awais

Hi,

Thanks for creating a demo.

We have logged this issue in our database. We will look into it and provide you a solution or fix asap.

This issue has been logged as CELLSNET-40480.

Hi,


It looks you are using some older version of the product. Could you give it a try our latest version of GridWeb v2.7.4.xxxx, you may get the version installing our latest version of Aspose.Cells for .NET v7.1.2:
http://www.aspose.com/community/files/51/.net-components/aspose.cells-for-.net/entry367730.aspx


We also evaluate your issue in the mean time.

Thank you.

No I used latest version and still same problem.

Regards,
Awais

Hi,

Thanks for testing it with latest version.

I have logged your comment against the issue id: CELLSNET-40480

Hi,

After investigation, we found that you are not using the latest acw_main directory.

Please use the latest acw_main directory and more specifically use the latest acwmain.js file

I have packaged it, you can find it from this link:
Aspose.Cells
for GridWeb v2.7.4.2000


Please also note that we override print method, so clients can use

gridwebid.print() method to print.

Suppose, your control name is “MainContent_GridWeb1”, so you can call print method in javascript like this.

MainContent_GridWeb1.print()

I just tested with latest version but no luck :(.

And to make it clear I do not want to use gridwebid.print() method instead just default window method, so could it be possible to do that?


Hi,

Did you use the latest acwmain.js file?

Please attach it here, so that I could make sure you are using the latest one.

Please use webgrid.print() method instead of window print method because it has overriden the window print method.

Probably, you will have to override webgrid.print method if you want to bypass it.

The file is attached. Could you explain how would I re-override the webgrid.print method?

Hi,

Please use something like this to use the print function.

<asp:Button onClick = “<% this.GridWeb1.ID %>.print();return false;” …/>

Hi,

We have made the following changes in your demo files.

Demo.Master file:

Add

<script type="text/javascript">
var newprint = window.print;
</script>


Default.aspx:

Add/changed:


<a href="#" onclick='javascript :newprint(); return false;'>print function by default</a>
<a href="#" onclick='<%=this.GridWeb1.ClientID%>.print(); '>print function by gridweb</a>


If you want to use default print function of window.print; you can try “newprint();”

If user want to use default print function by gridweb, you can try <%=this.GridWeb1.ClientID%>.print();

Please add Aspose.Cells for GridWeb DLL when you build the project.

Thanks Shakeel, much
<o:OfficeDocumentSettings>
<o:AllowPNG/>
</o:OfficeDocumentSettings>
<![endif]–><!–[if gte mso 9]>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:TrackMoves/>
<w:TrackFormatting/>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:DoNotPromoteQF/>
<w:LidThemeOther>EN-US</w:LidThemeOther>
<w:LidThemeAsian>X-NONE</w:LidThemeAsian>
<w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:SplitPgBreakAndParaMark/>
<w:EnableOpenTypeKerning/>
<w:DontFlipMirrorIndents/>
<w:OverrideTableStyleHps/>
</w:Compatibility>
<m:mathPr>
<m:mathFont m:val=“Cambria Math”/>
<m:brkBin m:val=“before”/>
<m:brkBinSub m:val="–"/>
<m:smallFrac m:val=“off”/>
<m:dispDef/>
<m:lMargin m:val=“0”/>
<m:rMargin m:val=“0”/>
<m:defJc m:val=“centerGroup”/>
<m:wrapIndent m:val=“1440”/>
<m:intLim m:val=“subSup”/>
<m:naryLim m:val=“undOvr”/>
</m:mathPr></w:WordDocument>
<![endif]–><!–[if gte mso 10]>

/* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin-top:0in; mso-para-margin-right:0in; mso-para-margin-bottom:10.0pt; mso-para-margin-left:0in; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi;}

<![endif]–><span style=“font-size:11.0pt;line-height:115%;
font-family:“Calibri”,“sans-serif”;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:
Calibri;mso-fareast-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:“Times New Roman”;mso-bidi-theme-font:minor-bidi;
mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA”>appreciated.

Regards,
Awais

How can I get to use the gridweb print on chrome correctly, the javascript I used for IE does not seem to work for chrome?

gridRV = document.getElementById('<%= gwRV.ClientID %>');

gridRV.print();

Hi,

Thanks for your posting and using Aspose.Cells.

I have tested this issue with the sample project attached with earlier post with the latest version of GridWeb i.e Aspose.Cells for .NET 8.5.2 and found GridWeb print works fine in FireFox but it does not work on Chrome.

I have attached the screenshots of my results for a reference.

We have logged this issue in our database for investigation. We will look into it and fix this issue. Once the issue is resolved or we have some other update for you, we will let you know asap.

This issue has been logged as

  • CELLSNET-43875 - Gridweb Print on Chrome does not work correctly

Hi,

Thanks for using Aspose.Cells.

This is to inform you that we have fixed your issue CELLSNET-43875 now. We will soon provide the fix after performing QA and including other enhancements and fixes.

Hi,

Thanks for using Aspose.Cells for GridWeb.

We have fixed this issue in acwmain.js file which is attached with this post. Please download it and remove its .txt extension because I added this extension just to upload it on this post.

I have also attached the latest GridWeb version, please download it and use it and before using it, replace its existing acwmain.js file with the attached fixed acwmain.js file. The acwmain.js is found inside the acw_client directory.

Let us know your feedback.

The issues you have found earlier (filed as CELLSNET-43875) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.