<!–[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:0in;
mso-para-margin-bottom:.0001pt;
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:Arial;
mso-bidi-theme-font:minor-bidi;}
<![endif]–>
Unfortunately, same error occurs! I'm looping to fill my grid with no issues then add new column using this line:
_Sheet.Cells.InsertColumn(2);
then the attached exception in the original post
Note: the old solution completes the filling successfully!
Hi,
Thanks for your posting and using Aspose.Cells for GridWeb.
Could you please drill down the problem and provide us your sample project replicating this issue (exception) using the latest version:
Aspose.Cells
for GridWeb v2.7.6.2006
We will soon look into it and help you asap.
Thanks for your rapid reply. Here is sample code:
//Format Worksheet
OGGrid.MaxColumn = _Sheet.Cells.MaxColumn;
OGGrid.MaxRow = _Sheet.Cells.MaxRow;
_Sheet.AutoFitColumn(0);
//ADD remaining amout column
_Sheet.Cells.InsertColumn(2);
for (int i = 1; i <= _Values.Length; i++)
{
_Sheet.Cells[i, 2].Formula = “=(B” + (i + 1) + “-” + _Sheet.Cells[i, _Sheet.Cells.MaxColumn].Name + “)”;
_Sheet.Cells[i, 2].IsReadonly = true;
}
Hi,
I have tried to reproduce your mentioned issue with the latest version of Aspose.GridWeb, but was not able to get success in this. I loaded an excel file, containing some test data and was able to insert a column before the “B” column in the workbook. I then saved the output workbook. I have attached the source and generated workbooks here for your reference. My code is as follow:
GridWeb1.WebWorksheets.ImportExcelFile("K://Test.xls");
WebWorksheet sheet = GridWeb1.WebWorksheets[1];
//Inserting a new column to the worksheet before column "B"
sheet.Cells.InsertColumn(1);
GridWeb1.ActiveSheetIndex = 1;
GridWeb1.WebWorksheets.SaveToExcelFile("K://TestOutput.xls");
It will be more easy for us to investigate your issue and assist you in a better manner if you can share your complete sample project with us.
Hi,
After deep investigation, i figured out the issue. when i commented this line, everything is OK.
_Sheet.Cells[_Values.Length + 1, i + 3].Formula =
“=SUM(”
+ _Sheet.Cells[0, i + 3].Name.Substring(0, _Sheet.Cells[0, i + 3].Name.Length - 1) + “2:” + _Sheet.Cells[0, i + 3].Name.Substring(0, _Sheet.Cells[0, i + 3].Name.Length - 1)+ (_Values.Length + 1).ToString()")";
this line returns _Sheet.Cells[6, 3].Formula = “=SUM(D2:D6)”;
I guess the formula has amended something wrong to _Sheet object,Which would lead to this error:
<!–[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>AR-SA</w:LidThemeComplexScript>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:SplitPgBreakAndParaMark/>
<w:EnableOpenTypeKerning/>
<w:DontFlipMirrorIndents/>
<w:OverrideTableStyleHps/>
</w:Compatibility>
<w:DoNotOptimizeForBrowser/>
<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:0in;
mso-para-margin-bottom:.0001pt;
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:Arial;
mso-bidi-theme-font:minor-bidi;}
<![endif]–><span style=“font-size:11.0pt;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:Arial;
mso-bidi-theme-font:minor-bidi;mso-ansi-language:EN-US;mso-fareast-language:
EN-US;mso-bidi-language:AR-SA”>Unable to cast object of type
‘System.Collections.SortedList’ to type
‘Aspose.Cells.GridWeb.Data.CellAttachObject’.
when i call this line
_Sheet.Cells.InsertColumn(2);
So, any help?
Hi,
Thanks for your posting and using Aspose.Cells for GridWeb.
Please download and use the latest version:
Aspose.Cells
for GridWeb v2.7.8.2011
It should fix your mentioned problem. Let us know your feedback.
If the problem still occurs, then please provide us your simple sample project replicating this issue using the latest version.
We will look into it and help you asap.
I used the latest version and problem still exists. Here is a sample code
OGGrid.WebWorksheets.Add();
OGGrid.WebWorksheets.ActiveSheetIndex = 0;
WebWorksheets _Sheets = OGGrid.WebWorksheets;
WebWorksheet _Sheet = _Sheets.ActiveSheet;
//Create Formula cells for totals row
_Sheet.Cells[_Values.Length + 1, 3].Formula = “=SUM(” + _Sheet.Cells[0, 3].Name.Substring(0, _Sheet.Cells[0, 3].Name.Length - 1) + “2:” + _Sheet.Cells[0,3].Name.Substring(0, _Sheet.Cells[0, 3].Name.Length - 1) + (_Values.Length + 1).ToString() + “)”; // =Sum(D2:D6)
_Sheet.Cells.InsertColumn(2); //Error occurred
_Sheet.AutoFitColumns(0, _Columns.Length + 2);
when i commented Formula assignment line, everything works fine. Any help?
Hi,
Thanks for your sample code.
I need to know the values of _Values.Length and _Columns.Length variables to run your code as highlighted in the screenshot below.
Could you please provide me your complete sample runnable project? It will help us quickly find out the error and we will then log it in our database.
Screenshot:
Hi,
Thanks for using Aspose.Cells for GridWeb.
I have further investigated your issue and after little modification, I was able to replicate this issue at our end.
Below is a sample code that replicated this problem. Please see the screenshot below for your reference.
We will look into this issue and fix the problem and update you asap.
This issue has been logged as CELLSNET-40927.
C#
OGGrid.WebWorksheets.Add();
OGGrid.WebWorksheets.ActiveSheetIndex = 0;
WebWorksheets _Sheets = OGGrid.WebWorksheets;
WebWorksheet _Sheet = _Sheets.ActiveSheet;
//Create Formula cells for totals row
_Sheet.Cells[0 + 1, 3].Formula = “=SUM(D2:D6)”; // =Sum(D2:D6)
_Sheet.Cells.InsertColumn(2); //Error occurred
_Sheet.AutoFitColumns(0, 0 + 2);
Screenshot:
Hi,
Thanks for your rapid reply and that’s exactly what happens with us “the same exception” in the screen shot. I’m waiting for the fix as our migration is stopped till we solve this issue.
Best Regards,
Mohamed
Hi,
Thanks for your posting.
Please wait for 2~3 working days. As soon as there is a fix, we will update you here.
Also, we have attached your thread to this issue:CELLSNET-40927 in our database, so you will also get automatic notification when this bug will be fixed.
Hi,
We have fixed this issue.
Please download and use the latest fix: Aspose.Cells for GridWeb v2.7.8.2014
Hi,
I tried this version InsertColumns passed but it’s showing this error in grid prerender:
Object must be of type String.
Description:
An unhandled exception occurred during the execution of the current web
request. Please review the stack trace for more information about the error and
where it originated in the code.
Exception Details:
System.ArgumentException: Object must be of type String.
Source
Error:
An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of the
exception can be identified using the exception stack trace below.
|
Stack Trace:
[ArgumentException: Object must be of type String.]
System.String.CompareTo(Object value) +2984761
System.Collections.Comparer.Compare(Object a, Object b) +94
System.Array.BinarySearch(Array array, Int32 index, Int32 length, Object value, IComparer comparer) +229
[InvalidOperationException: Failed to compare two elements in the array.]
System.Array.BinarySearch(Array array, Int32 index, Int32 length, Object value, IComparer comparer) +289
System.Collections.SortedList.IndexOfKey(Object key) +31
System.Collections.SortedList.get_Item(Object key) +15
Aspose.Cells.GridWeb.Data.Validations.(WebCell ) +158
Aspose.Cells.GridWeb.Data.WebCellImpl.get_Validation() +45
Aspose.Cells.GridWeb.GridWeb.() +19348
Aspose.Cells.GridWeb.GridWeb.OnPreRender(EventArgs e) +1039
System.Web.UI.Control.PreRenderRecursiveInternal() +80
System.Web.UI.Control.PreRenderRecursiveInternal() +171
System.Web.UI.Control.PreRenderRecursiveInternal() +171
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +842
|
Any help please?
Hi,
Thanks for your feedback and using Aspose.Cells for GridWeb.
I have looked into your issue and I was able to find this exception as you mentioned.
I have logged the exception in our database. We will soon look into this exception and resolve the problems.
Hi,
Thanks for your reporting and using Aspose.Cells for GridWeb.
We have fixed the exception. Please download and try the latest version: Aspose.Cells for GridWeb v2.7.8.2015
Hi,
Thanks. It fixed the issue. but another exception appeared when loading the grid:
Microsoft JScript runtime error: ‘acwmain’ is undefined
kindly find the attached screenshot.
Any help?
Thanks
Hi,
Thanks for your feedback.
Have you updated both files i.e
1 - Aspose.Cells.GridWeb.dll
2 - acw_client (folder)
For the second one, please first delete your existing acw_client folder and then add the new one at the same location. It should fix the problem.
If the problem still occurs, then please let us know. We will look into it.
Hi,
the current version that i want to upgrade doesn’t contain this folder “acw_client”. So, where can i add this folder in my project structure?
my project structure is:
-App_Code
-aspnet_client
-Bin
-demos
- Common
- default.aspx //single page contains all code
- default.aspx.cs
-images
-js
-style
-forecast.sln //solution file
Thanks in advance…
Hi,
Thanks for your question.
Please follow these steps.
1 - Please create a folder and name it anything. Suppose you name it grid and copy the acw_client folder inside it
Now your directory structure will look like this
App_Code
-aspnet_client
-Bin
-grid
- acw_client
-demos
- Common
- default.aspx //single page contains all code
- default.aspx.cs
-images
-js
-style
2 - Now open your
Web.config file and add the following settings in your appsettings.
Now you are done and it should fix your problem. Let us know if you still face any issue, we will be glad to assist you.
The issues you have found earlier (filed as CELLSNET-40927) have been fixed in this update.
This message was posted using Notification2Forum from Downloads module by aspose.notifier.