Fórum Planilha Excel #334428
08/12/2006
0
Essa possibilidade existe?
Desde já agradeço
Marcelo
Marcelo_mileris
Curtir tópico
+ 0Posts
11/12/2006
Marcelo_mileris
Excel.Cells.Select; // Seleciona a planilha Excel.Cells.Locked := False; // Retira a proteção Excel.Cells.FormulaHidden := False; // Retira a proteção Excel.Cells.Locked := True; Excel.Cells.FormulaHidden := True; Excel.WorkBooks.Protect(´senha´,True,True);
Alguém sabe onde tem um material sobre Delphi e Excel? Nem que seja em inglês
Gostei + 0
12/12/2006
Marcelo_mileris
Gostei + 0
13/12/2006
Helio Nascimento
Poste aqui a sua solução.
Obrigado/Hélio
Gostei + 0
13/12/2006
Marcelo_mileris
var Excel : OleVariant; X : Integer; begin Excel := CreateOleObject(´Excel.Application´); Excel.Visible := False; Excel.WorkBooks.Add; // -> ATIVA PADRÃO BRANCO NA PLANILHA Excel.Cells.Select; Excel.Cells.Interior.ColorIndex := 2; Excel.Cells.Interior.Pattern := xlSolid; Excel.Cells.Interior.PatternColorIndex := xlAutomatic; // -> PREFEITURA MUNICIPAL Excel.ActiveCell.FormulaR1C1 := ´PREFEITURA MUNICIPAL´; Excel.Range[´A1´,´K1´].MergeCells := True; Excel.Range[´A1´,´K1´].HorizontalAlignment := xlCenter; Excel.Range[´A1´,´K1´].Font.Bold := True; Excel.Range[´A1´,´K1´].Font.Underline := True; Excel.Range[´A1´,´K1´].Font.Size := 14; // -> SECRETARIA Excel.Range[´A2´,´K2´].Select; Excel.ActiveCell.FormulaR1C1 := ´Secretaria Municipal de Administração e Recursos Humanos´; Excel.Range[´A2´,´K2´].MergeCells := True; Excel.Range[´A2´,´K2´].HorizontalAlignment := xlCenter; Excel.Range[´A2´,´K2´].Font.Bold := True; Excel.Range[´A2´,´K2´].Font.Size := 10; // -> COTAÇÃO DE PREÇOS Excel.Range[´A4´,´K4´].Select; Excel.ActiveCell.FormulaR1C1 := ´COTAÇÃO DE PREÇOS´; Excel.Range[´A4´,´K4´].MergeCells := True; Excel.Range[´A4´,´K4´].HorizontalAlignment := xlCenter; Excel.Range[´A4´,´K4´].Font.Bold := True; Excel.Range[´A4´,´K4´].Font.Size := 10; Excel.Cells.Select; // Seleciona a planilha Excel.Cells.Locked := False; // Retira a proteção Excel.Cells.FormulaHidden := False; // Retira a proteção Excel.Range[´A1´,´K4´].Select; // Seleciona as Células Excel.Selection.Locked := True; // Ativa Proteção Excel.Selection.FormulaHidden := True; // Ativa Proteção Excel.ActiveSheet.Protect(´senha´, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True); Excel.ActiveWorkbook.SaveAs(´C:\Teste.xls´); Excel.ActiveWorkBook.Close;
Gostei + 0
13/12/2006
Helio Nascimento
Obrigaduuuuuu.
Sds/Hélio
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)