Click here to Skip to main content
15,122,218 members
Home / Discussions / C#
   

C#

 
QuestionC# interacting with Excel Pin
Ismael Oliveira 202116-Aug-21 14:15
MemberIsmael Oliveira 202116-Aug-21 14:15 
AnswerRe: C# interacting with Excel Pin
Richard Deeming16-Aug-21 22:36
mveRichard Deeming16-Aug-21 22:36 
GeneralRe: C# interacting with Excel Pin
Ismael Oliveira 202124-Aug-21 13:46
MemberIsmael Oliveira 202124-Aug-21 13:46 
AnswerRe: C# interacting with Excel Pin
Richard MacCutchan16-Aug-21 22:42
mveRichard MacCutchan16-Aug-21 22:42 
AnswerRe: C# interacting with Excel Pin
SpiveyC#7-Sep-21 2:44
MemberSpiveyC#7-Sep-21 2:44 
QuestionHow to merge cells in Excel using C# Pin
Ismael Oliveira 202112-Aug-21 13:43
MemberIsmael Oliveira 202112-Aug-21 13:43 
AnswerRe: How to merge cells in Excel using C# Pin
Richard MacCutchan12-Aug-21 22:35
mveRichard MacCutchan12-Aug-21 22:35 
GeneralRe: How to merge cells in Excel using C# Pin
Ismael Oliveira 202113-Aug-21 14:45
MemberIsmael Oliveira 202113-Aug-21 14:45 
Hi, Richard.
You are right. There was a problem in my definition. I correct it and the problem with merge disappeared. The spreadsheet is created correctly, but I could not make it appear. I changed the routine to the formload event. See the code:
private void Form1_Load(object sender, EventArgs e)
{
    string Arquivo = @"D:\Diversos\Antares\Relatório.xlsx";
    Excel.Application xlApp;
    Excel.Workbook xlWorkBook;
    Excel.Worksheet xlWorkSheet;
    object misValue = System.Reflection.Missing.Value;

    //Cria uma planilha temporária na memória do computador
    xlApp = new Excel.Application();
    xlWorkBook = xlApp.Workbooks.Add(misValue);
    xlWorkSheet = (Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1);
    xlWorkSheet.Range[xlWorkSheet.Cells[1, 1], xlWorkSheet.Cells[1, 4]].Merge();
    xlWorkSheet.Visible = XlSheetVisibility.xlSheetVisible;

    //incluindo dados
    xlWorkSheet.Cells[1, 1] = "Dados do cliente:";
}

The problem now is that I can't make the spreadsheet visible. The line:
xlWorkSheet.Visible = XlSheetVisibility.xlSheetVisible;

appears not to work. Do you know what I must do to correct it?
Thanks.
GeneralRe: How to merge cells in Excel using C# Pin
Richard MacCutchan13-Aug-21 22:44
mveRichard MacCutchan13-Aug-21 22:44 
GeneralRe: How to merge cells in Excel using C# Pin
Ismael Oliveira 202114-Aug-21 13:46
MemberIsmael Oliveira 202114-Aug-21 13:46 
GeneralRe: How to merge cells in Excel using C# Pin
Richard MacCutchan14-Aug-21 22:09
mveRichard MacCutchan14-Aug-21 22:09 
QuestionPassing a variable from an string to a For loop Pin
Alex Dunlop12-Aug-21 0:55
MemberAlex Dunlop12-Aug-21 0:55 
AnswerRe: Passing a variable from an string to a For loop Pin
Pete O'Hanlon12-Aug-21 3:28
mvePete O'Hanlon12-Aug-21 3:28 
GeneralRe: Passing a variable from an string to a For loop Pin
harold aptroot12-Aug-21 3:42
Memberharold aptroot12-Aug-21 3:42 
AnswerRe: Passing a variable from an string to a For loop Pin
Richard Deeming12-Aug-21 3:48
mveRichard Deeming12-Aug-21 3:48 
AnswerRe: Passing a variable from an string to a For loop Pin
jsc4212-Aug-21 4:08
professionaljsc4212-Aug-21 4:08 
AnswerRe: Passing a variable from an string to a For loop Pin
Dave Kreskowiak12-Aug-21 4:32
mveDave Kreskowiak12-Aug-21 4:32 
AnswerRe: Passing a variable from an string to a For loop Pin
Gerry Schmitz12-Aug-21 5:13
mveGerry Schmitz12-Aug-21 5:13 
AnswerRe: Passing a variable from an string to a For loop Pin
OriginalGriff12-Aug-21 5:20
mveOriginalGriff12-Aug-21 5:20 
GeneralRe: Passing a variable from an string to a For loop Pin
Alex Dunlop12-Aug-21 7:16
MemberAlex Dunlop12-Aug-21 7:16 
GeneralRe: Passing a variable from an string to a For loop Pin
OriginalGriff12-Aug-21 7:36
mveOriginalGriff12-Aug-21 7:36 
GeneralRe: Passing a variable from an string to a For loop Pin
Alex Dunlop12-Aug-21 9:55
MemberAlex Dunlop12-Aug-21 9:55 
GeneralRe: Passing a variable from an string to a For loop Pin
OriginalGriff12-Aug-21 23:49
mveOriginalGriff12-Aug-21 23:49 
GeneralRe: Passing a variable from an string to a For loop Pin
Alex Dunlop13-Aug-21 8:26
MemberAlex Dunlop13-Aug-21 8:26 
GeneralRe: Passing a variable from an string to a For loop Pin
Alex Dunlop13-Aug-21 8:31
MemberAlex Dunlop13-Aug-21 8:31 

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.