[ marko v @ 14.05.2005. 20:29 ] @
Slijedeći kod :
DataView dv = new DataView(this.ispis1.MyFilms);
int j= dv.Table.Rows.Count;
string []a = new string[j];
string []b = new string[j];
string []c = new string[j];
string []d = new string[j];
string []h = new string[j];
BindingManagerBase bmb;
bmb= this.BindingContext[this.ispis1.MyFilms];
for(int i=0;i<j;i++)
{
DataRowView drv =(DataRowView)bmb.Current;
DataRow dr = drv.Row;

a=dr["Redni Broj"].ToString() + " ";
b=dr["ImeFilma"].ToString() + " ";
c=dr["BrojMedija"].ToString() + " ";
d=dr["GlavnaUloga"].ToString() + " ";
h=dr["Veličina"].ToString() + "\t ";

bmb.Position++;

}

if(this.saveFileDialog1.ShowDialog()==DialogResult.OK)
{
FileStream fs = new FileStream(saveFileDialog1.FileName,FileMode.Create);
StreamWriter sw = new StreamWriter(fs);
for(int z =0;z< j;z++)
{
sw.Write(a[z]);
sw.Write(b[z]);
sw.Write(c[z]);
sw.Write(d[z]);
sw.Write(h[z]);
sw.Write("\n");

}
sw.Close();
fs.Close();
}


upisuje mi u word datoteku sadržaj iz access tablice.
Problem je šta nemogu poravnati ispis tako da npr "GlavnaUloga" iz svakog retka dodje točno ispod one iz prethodnog.
Kako da formatiram ovaj zapis?
[ adnan78 @ 08.06.2005. 16:45 ] @
Ja bih ti predlozio da snimas kao tabDelimited file, i da importujes u excel, posto mi se cini da ti sve ovo radis da bi to stampao kao neki izvjestaj ili tako nesto....
znaci
file.WriteLine( "kol1" + "\t" + "kol2" + "\t" + "kol3");
file.WriteLine( "111" + "\t" + "222" + "\t" + "333"); // Primjeti da ne treba nista na kraju jer koristis WriteLine

Ako ipak hoces da snimas kao word doc
http://msdn.microsoft.com/vstudio/office/officetools.aspx