Click here to Skip to main content
15,896,201 members
Home / Discussions / C#
   

C#

 
AnswerRe: Need help with Functions, ASAP! Pin
Gerry Schmitz13-Apr-18 7:15
mveGerry Schmitz13-Apr-18 7:15 
AnswerRe: Need help with Functions, ASAP! Pin
#realJSOP13-Apr-18 7:49
professional#realJSOP13-Apr-18 7:49 
AnswerRe: Need help with Functions, ASAP! Pin
BillWoodruff13-Apr-18 7:51
professionalBillWoodruff13-Apr-18 7:51 
GeneralRe: Need help with Functions, ASAP! Pin
#realJSOP13-Apr-18 7:53
professional#realJSOP13-Apr-18 7:53 
GeneralRe: Need help with Functions, ASAP! Pin
BillWoodruff13-Apr-18 9:12
professionalBillWoodruff13-Apr-18 9:12 
GeneralRe: Need help with Functions, ASAP! Pin
Gerry Schmitz16-Apr-18 8:17
mveGerry Schmitz16-Apr-18 8:17 
GeneralRe: Need help with Functions, ASAP! Pin
#realJSOP13-Apr-18 8:26
professional#realJSOP13-Apr-18 8:26 
GeneralRe: Need help with Functions, ASAP! Pin
#realJSOP13-Apr-18 8:31
professional#realJSOP13-Apr-18 8:31 
GeneralRe: Need help with Functions, ASAP! Pin
BillWoodruff13-Apr-18 9:14
professionalBillWoodruff13-Apr-18 9:14 
GeneralRe: Need help with Functions, ASAP! Pin
#realJSOP13-Apr-18 8:42
professional#realJSOP13-Apr-18 8:42 
GeneralRe: Need help with Functions, ASAP! Pin
Eddy Vluggen13-Apr-18 9:01
professionalEddy Vluggen13-Apr-18 9:01 
GeneralRe: Need help with Functions, ASAP! Pin
#realJSOP13-Apr-18 9:07
professional#realJSOP13-Apr-18 9:07 
GeneralRe: Need help with Functions, ASAP! Pin
Eddy Vluggen13-Apr-18 9:12
professionalEddy Vluggen13-Apr-18 9:12 
GeneralRe: Need help with Functions, ASAP! Pin
#realJSOP13-Apr-18 9:28
professional#realJSOP13-Apr-18 9:28 
AnswerRe: Need help with Functions, ASAP! Pin
#realJSOP13-Apr-18 9:10
professional#realJSOP13-Apr-18 9:10 
PraiseRe: Need help with Functions, ASAP! Pin
Eddy Vluggen13-Apr-18 9:15
professionalEddy Vluggen13-Apr-18 9:15 
GeneralRe: Need help with Functions, ASAP! Pin
#realJSOP13-Apr-18 9:33
professional#realJSOP13-Apr-18 9:33 
GeneralRe: Need help with Functions, ASAP! Pin
BillWoodruff13-Apr-18 18:54
professionalBillWoodruff13-Apr-18 18:54 
Questiongetting a 200 or what ever it is status_code not a ok Pin
sadsack12-Apr-18 9:04
sadsack12-Apr-18 9:04 
AnswerRe: getting a 200 or what ever it is status_code not a ok Pin
Afzaal Ahmad Zeeshan12-Apr-18 9:23
professionalAfzaal Ahmad Zeeshan12-Apr-18 9:23 
GeneralRe: getting a 200 or what ever it is status_code not a ok Pin
sadsack17-Apr-18 13:59
sadsack17-Apr-18 13:59 
AnswerRe: getting a 200 or what ever it is status_code not a ok Pin
Richard MacCutchan12-Apr-18 21:38
mveRichard MacCutchan12-Apr-18 21:38 
GeneralRe: getting a 200 or what ever it is status_code not a ok Pin
sadsack17-Apr-18 14:02
sadsack17-Apr-18 14:02 
QuestionWrite a 2D array of objects in range Excel C# Pin
Gtari Abir12-Apr-18 5:29
Gtari Abir12-Apr-18 5:29 
Hello,
I created a new user defined function in excel using c#,what i want to get is when a user open an excel file, clic on a cell and write =myFunction() press enter, data should be displayed in the excel file. these data are retrieved from sql server database and stocked in a 2D array of object, my problem is when i try to display this array in excel range i got this exception
Exception de HRESULT : 0x800A03EC

Below is my code :
C#
public static void LoadViewData()
      {
          var target = (ExcelReference)XlCall.Excel(XlCall.xlfCaller);
          var sheetName = (string)XlCall.Excel(XlCall.xlSheetNm, target);
          var application = (Microsoft.Office.Interop.Excel.Application)ExcelDnaUtil.Application;
          var sheet = application.Sheets[Regex.Replace(sheetName, @"\[[^]]*\]", string.Empty)];
          object[,] result = LoadFromDbData();
          var startCell =sheet.Cells[target.RowFirst + 1, target.ColumnFirst];
          var endCell =sheet.Cells[target.RowFirst+ result.GetUpperBound(0) - result.GetLowerBound(0) + 1,
              target.ColumnFirst+ result.GetUpperBound(1) - result.GetLowerBound(1) + 1];
          var writeRange = sheet.Range[startCell, endCell];

          writeRange.Value2 = result;

      }

target returns the correct value of the cell where the user has written the formula (=myFunction())
sheetName returns the correct activeSheet in which the user writes the formula
result contains the data retrieved from sql server, it is an array of object[854,8]
startcell and endcell represents the range from which cell to which cell data will be displayed
when debugging, all variables contain the correct values, the exception appears in this instruction :
C#
writeRange.Value2 = result;

Anyone has already worked with this or can help please ?
Thanks
AnswerRe: Write a 2D array of objects in range Excel C# Pin
Dave Kreskowiak12-Apr-18 7:29
mveDave Kreskowiak12-Apr-18 7:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.