Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: C# Office Excel
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
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

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;
                        hrefcheck = hrefcheck.NextMatch();
                    string matchurl = "";
                    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 30-Jul-12 7:43am
Edited 30-Jul-12 7:44am
Kenneth Haugland at 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 at 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?
TAR_FAST at 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 at 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.
TAR_FAST at 30-Jul-12 15:33pm
didnt work

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

You may see here to find your solution: Summarize C# Control Excel Skills[^]

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

Advertise | Privacy | Mobile
Web03 | 2.8.140709.1 | Last Updated 30 Jul 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid