Click here to Skip to main content
15,885,278 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi I have following code that works fine, I can get values and add them to excel sheet. Only problem i have is last line
C#
xla.Cells[add, 4] = anchorlist;

it wont print the value for this anchor text "Missing parameter does not have a default value. Parameter name: parameters"
any idea how to fix it? Thanks


C#
Match hrefcheck = hrefRegex.Match(htmlpage);
                    ArrayList linklist = new ArrayList();

                    // linklist.Add("<BASE href=\"" + url + "\">" + url);
                    ArrayList anchorlist = new ArrayList();
                    while (hrefcheck.Success)
                    {
                        string href = hrefcheck.Groups["href"].Value; //link url
                        string attr = hrefcheck.Groups["Anchor"].Value;
                        anchorlist.Add(attr);
                        linklist.Add(href);
                        hrefcheck = hrefcheck.NextMatch();
                    }

                    string matchurl = "xyz.com";

                    foreach (string str in linklist)
                    {
                        if (str.Contains(matchurl) == true)
                        {
                           
                            Microsoft.Office.Interop.Excel.Application xla = new Microsoft.Office.Interop.Excel.Application();
                            Workbook wb = xla.Workbooks.Add(XlSheetType.xlWorksheet);
                            Worksheet ws = (Worksheet)xla.ActiveSheet;
                            xla.Visible = true
                            xla.Cells[add, 1] = urltextBox.Text;
                            xla.Cells[add, 2] = str;
                            xla.Cells[add, 3] = s;
                            xla.Cells[add, 4] = anchorlist;
                           
                       }

                    }
Posted
Updated 30-Jul-12 7:44am
v2
Comments
Kenneth Haugland 30-Jul-12 13:47pm    
Are you sure the add has a value? And have you tried xla.Cells[add, 1].Value = str; etc ?
Kenneth Haugland 30-Jul-12 13:52pm    
And also, o you really mean to create a new file fo reach of the parameters in linklist that has a matchurl?
EricThe 30-Jul-12 14:09pm    
Yes, the create file etc everything works fine, the values are added only value it is not picking up is the anchortag
Kenneth Haugland 30-Jul-12 14:14pm    
It also looks like you are trying to write an array to a single cell in anchorlist, you should write anchorlist.tostring in that one and see what haoppens.
EricThe 30-Jul-12 15:33pm    
didnt work

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900