Einzelnen Beitrag anzeigen

ErdNussLocke

Registriert seit: 30. Jan 2006
104 Beiträge
 
#8

Re: Excel Bordereinstellungen

  Alt 20. Okt 2008, 10:04
Inzwischen zeigt er "Mitglied nicht gefunden".

Delphi-Quellcode:
    //Sheets befüllen
    for M := 1 to BookCount do
    begin
        for N := 1 to SheetCount do
        begin
          //Daten aus Grid holen
          Data := VarArrayCreate([1, Grid.RowCount, 1, SheetColCount], varVariant);
          for I := 0 to SheetColCount - 1 do
            for J := 0 to SheetRowCount - 1 do
              if ((I+256*(N-1)) <= Grid.ColCount) and ((J+65536*(M-1)) <= Grid.RowCount) then
                Data[J + 1, I + 1] := Grid.Cells[I+256*(N-1), J+65536*(M-1)];

          XLApp.Worksheets[N].Select;
          XLApp.Workbooks[M].Worksheets[N].Name := SheetName + IntToStr(N);
          //Zellen als String Formatieren
          XLApp.Workbooks[M].Worksheets[N].Range[RefToCell(1, 1), RefToCell(SheetRowCount,
            SheetColCount)].Select;
          XLApp.Selection.NumberFormat := '@';
          XLApp.Workbooks[M].Worksheets[N].Range['A1'].Select;

//Macro

          XLApp.Selection.Borders(xlDiagonalDown).LineStyle := xlNone;
          XLApp.Selection.Borders(xlDiagonalUp).LineStyle := xlNone ;
          XLApp.Selection.Borders(xlEdgeLeft).LineStyle := xlContinuous;
          XLApp.Selection.Borders(xlEdgeLeft).Weight := xlThin;
          XLApp.Selection.Borders(xlEdgeLeft).ColorIndex := xlAutomatic;
          XLApp.Selection.Borders(xlEdgeTop).LineStyle := xlContinuous;
          XLApp.Selection.Borders(xlEdgeTop).Weight := xlThin;
          XLApp.Selection.Borders(xlEdgeTop).ColorIndex := xlAutomatic;
          XLApp.Selection.Borders(xlEdgeBottom).LineStyle := xlContinuous;
          XLApp.Selection.Borders(xlEdgeBottom).Weight := xlThin;
          XLApp.Selection.Borders(xlEdgeBottom).ColorIndex := xlAutomatic;
          XLApp.Selection.Borders(xlEdgeRight).LineStyle := xlContinuous;
          XLApp.Selection.Borders(xlEdgeRight).Weight := xlThin;
          XLApp.Selection.Borders(xlEdgeRight).ColorIndex := xlAutomatic;
          XLApp.Selection.Borders(xlInsideVertical).LineStyle := xlContinuous;
          XLApp.Selection.Borders(xlInsideVertical).Weight := xlThin;
          XLApp.Selection.Borders(xlInsideVertical).ColorIndex := xlAutomatic;
          XLApp.Selection.Borders(xlInsideHorizontal).LineStyle := xlContinuous;
          XLApp.Selection.Borders(xlInsideHorizontal).Weight := xlThin;
          XLApp.Selection.Borders(xlInsideHorizontal).ColorIndex := xlAutomatic;

//Macroende

          //Daten dem Excelsheet übergeben
          Sheet := XLApp.Workbooks[M].WorkSheets[N];
          Sheet.Range[RefToCell(1, 1), RefToCell(SheetRowCount,SheetColCount)].Value := Data;

        end;
    end;
  Mit Zitat antworten Zitat