Click here to Skip to main content
15,887,214 members
Home / Discussions / C#
   

C#

 
GeneralRe: Need help with Functions, ASAP! Pin
#realJSOP13-Apr-18 9:33
mve#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 
QuestionValidate User Against Active Directory Pin
Kevin Marois11-Apr-18 10:23
professionalKevin Marois11-Apr-18 10:23 
AnswerRe: Validate User Against Active Directory Pin
Keviniano Gayo11-Apr-18 21:55
Keviniano Gayo11-Apr-18 21:55 
GeneralRe: Validate User Against Active Directory Pin
Kevin Marois12-Apr-18 5:47
professionalKevin Marois12-Apr-18 5:47 
GeneralRe: Validate User Against Active Directory Pin
Keviniano Gayo13-Apr-18 1:49
Keviniano Gayo13-Apr-18 1:49 
QuestionGetting a directory path if directory name is given Pin
NiKHiLMS11-Apr-18 3:17
NiKHiLMS11-Apr-18 3:17 
AnswerRe: Getting a directory path if directory name is given Pin
Richard MacCutchan11-Apr-18 3:32
mveRichard MacCutchan11-Apr-18 3:32 
GeneralRe: Getting a directory path if directory name is given Pin
NiKHiLMS11-Apr-18 21:38
NiKHiLMS11-Apr-18 21:38 
GeneralRe: Getting a directory path if directory name is given Pin
Jochen Arndt11-Apr-18 22:37
professionalJochen Arndt11-Apr-18 22:37 
GeneralRe: Getting a directory path if directory name is given Pin
NiKHiLMS11-Apr-18 22:51
NiKHiLMS11-Apr-18 22:51 
GeneralRe: Getting a directory path if directory name is given Pin
Jochen Arndt12-Apr-18 0:01
professionalJochen Arndt12-Apr-18 0:01 
AnswerRe: Getting a directory path if directory name is given Pin
MadMyche11-Apr-18 5:04
professionalMadMyche11-Apr-18 5:04 
GeneralRe: Getting a directory path if directory name is given Pin
NiKHiLMS11-Apr-18 21:39
NiKHiLMS11-Apr-18 21:39 
AnswerRe: Getting a directory path if directory name is given Pin
#realJSOP12-Apr-18 1:25
mve#realJSOP12-Apr-18 1:25 
Generalstring Pin
Baymediasoft technologies11-Apr-18 0:11
professionalBaymediasoft technologies11-Apr-18 0:11 
GeneralRe: string Pin
OriginalGriff11-Apr-18 0:26
mveOriginalGriff11-Apr-18 0:26 
GeneralRe: string Pin
Richard MacCutchan11-Apr-18 1:44
mveRichard MacCutchan11-Apr-18 1:44 

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.