İçeriğe geç
ShiftDelete.Net
Haber ara/ SDN'ye SorGiriş
Haber Akışı SDNTV İnceleme Forum Yapay Zeka Akıllı Telefon Elektrikli Otomobil Oyun ShiftDelete.Net Global Teknoloji Haberleri Mobil Otomobil Donanım Savunma Bilim Sosyal Medya İnternet Giyilebilir Teknoloji Rehber Ürünler Son dakika Yazarlar
  1. Ana sayfa
  2. Topluluk
  3. Programlama
  4. Programlama Dilleri
Programlama Dilleri

Word Property

OnurSorhan17.07.20123 cevap1.239 görüntüleme
2012'den beri808 mesaj
#1
Bu Kodlarla DataGridview'de Word Dosyasının Property Gösterebiliyorum
Peki dataGridView1'den Örneğin Yazarını Değiştirdim Diyelim Nasıl Kayıtlı Kalmasını Sağlayabilirim Bu Değişikliğin

private FileInfo SelectedFileInfo;
private void listView1_SelectedIndexChanged_1(object sender, EventArgs e)
{
if (listViewFileInfoList.SelectedItems.Count > 0)
{
string FileName = listViewFileInfoList.SelectedItems[0].SubItems[0].Text;
string Path = listViewFileInfoList.SelectedItems[0].SubItems[1].Text;
string LastWriteTime = listViewFileInfoList.SelectedItems[0].SubItems[2].Text;
string Extension = listViewFileInfoList.SelectedItems[0].SubItems[6].Text;
string IsReadOnly = listViewFileInfoList.SelectedItems[0].SubItems[4].Text;
string CreationTime = listViewFileInfoList.SelectedItems[0].SubItems[5].Text;

SelectedFileInfo = new FileInfo(Path + "\\" + FileName);

if (SelectedFileInfo.Extension == ".doc" || SelectedFileInfo.Extension == ".docx")
{

DSOFile.OleDocumentProperties doc = new DSOFile.OleDocumentProperties();
doc.Open(SelectedFileInfo.FullName, false, DSOFile.dsoFileOpenOptions.dsoOptionDefault);


dataGridView1.Rows.Clear();
DataGridViewRow row1 = new DataGridViewRow();
row1.CreateCells(dataGridView1);
row1.Cells[0].Value = "Konu";
row1.Cells[1].Value = doc.SummaryProperties.Subject;
dataGridView1.Rows.Add(row1);
DataGridViewRow row2 = new DataGridViewRow();
row2.CreateCells(dataGridView1);
row2.Cells[0].Value = "Kategorisi";
row2.Cells[1].Value = doc.SummaryProperties.Category;
dataGridView1.Rows.Add(row2);
DataGridViewRow row3 = new DataGridViewRow();
row3.CreateCells(dataGridView1);
row3.Cells[0].Value = "Yazar";
row3.Cells[1].Value = doc.SummaryProperties.Author;
dataGridView1.Rows.Add(row3);
DataGridViewRow row4 = new DataGridViewRow();
row4.CreateCells(dataGridView1);
row4.Cells[0].Value = "Son Kaydeden";
row4.Cells[1].Value = doc.SummaryProperties.LastSavedBy;
dataGridView1.Rows.Add(row4);
dataGridView1.Update();
DataGridViewRow row5 = new DataGridViewRow();
row5.CreateCells(dataGridView1);
row5.Cells[0].Value = "Yorumlar";
row5.Cells[1].Value = doc.SummaryProperties.Comments ;
dataGridView1.Rows.Add(row5);
DataGridViewRow row6 = new DataGridViewRow();
row6.CreateCells(dataGridView1);
row6.Cells[0].Value = "Revizyon Numarası";
row6.Cells[1].Value = doc.SummaryProperties.RevisionNumber;
dataGridView1.Rows.Add(row6);
DataGridViewRow row7 = new DataGridViewRow();
row7.CreateCells(dataGridView1);
row7.Cells[0].Value = "Şirket";
row7.Cells[1].Value = doc.SummaryProperties.Company;
dataGridView1.Rows.Add(row7);
DataGridViewRow row8 = new DataGridViewRow();
row8.CreateCells(dataGridView1);
row8.Cells[0].Value = "Son Kaydedilme Tarihi";
row8.Cells[1].Value = doc.SummaryProperties.DateLastSaved;
dataGridView1.Rows.Add(row8);
DataGridViewRow row9 = new DataGridViewRow();
row9.CreateCells(dataGridView1);
row9.Cells[0].Value = "Sayfa Sayısı";
row5.Cells[1].Value = doc.SummaryProperties.PageCount;
dataGridView1.Rows.Add(row9);
DataGridViewRow row0 = new DataGridViewRow();
row0.CreateCells(dataGridView1);
row0.Cells[0].Value = "Boyut";
row0.Cells[1].Value = doc.SummaryProperties.Version + " Byte";
dataGridView1.Rows.Add(row0);
Cevaplar
OnurSorhan Konuyu açan
2012'den beri808 mesaj
#2
Bi Soru Vardı Orda Fakat :)))
OnurSorhan Konuyu açan
2012'den beri808 mesaj
#3
Misafir
#4
private void dataGridView1_CellEndEdit(object sender, DataGridViewCellEventArgs e)
{
if (e.ColumnIndex== 1 &&(SelectedFileInfo.Extension == ".doc" || SelectedFileInfo.Extension == ".docx"))
{
DSOFile.OleDocumentProperties doc = new DSOFile.OleDocumentProperties();
doc.Open(SelectedFileInfo.FullName, false, DSOFile.dsoFileOpenOptions.dsoOptionDefault);

switch (e.RowIndex)
{
case 0:
doc.SummaryProperties.Subject = dataGridView1.Rows[e.RowIndex].Cells[1].Value.ToString();
break;
case 1:
doc.SummaryProperties.Category = dataGridView1.Rows[e.RowIndex].Cells[1].Value.ToString();
break;
case 2:
doc.SummaryProperties.Author = dataGridView1.Rows[e.RowIndex].Cells[1].Value.ToString();
break;
case 3:
doc.SummaryProperties.LastSavedBy = dataGridView1.Rows[e.RowIndex].Cells[1].Value.ToString();
break;
case 4:
doc.SummaryProperties.Comments = dataGridView1.Rows[e.RowIndex].Cells[1].Value.ToString();
break;
case 6:
doc.SummaryProperties.Company = dataGridView1.Rows[e.RowIndex].Cells[1].Value.ToString();
break;
}
doc.Save();
}
}

Arayıpda Bulamadığım Kod Satrırı Buydu :)

Cevabını yaz

Cevap yazmak için giriş yap ya da üye ol. Eski forum kullanıcı adın ve parolanla girebilirsin.