Hola que tal? estoy desarrollando una aplicacion de escritorio en la que necesito cargar un documento de word 07 y pasar parametros al documento con informacion que necesito imprimir ... espero su ayuda, gracias!
Hola PeDraXyTo :D amm no te entendi muy bien qe diGamos, Espero no estar metiendo la pata, Mira hice una pequeña rutina aver si te refieres a eso, crea un documente en word, y puedes escribir en el, puedes hacer otra rutina para qe la mande a imprimir...
aqui esta Code:
using System;
using System.IO;
public class EscribirDoc{
public static void Main(string[] args)
{
StreamWriter sw = null;
String str;
Console.Title="DOCUMENTO, BY --> ^^ÂnGeL^^";
Console.BackgroundColor = ConsoleColor.White;
Console.ForegroundColor = ConsoleColor.Red;
Console.Clear();
try
{
sw = new StreamWriter("miDocumente.doc");
Console.WriteLine("ESCRIBA LAS LINEAS DE TEXTO A ALMACENAR EN EL FIHERO.\n"+
"FINALIZE CADA LINEA PULSANDO <ENTER>.\n"+
"PARA FINALIZAR PULSE SOLO LA TECLA <ENTER>..\n");
//Leer Una linea...
str = Console.ReadLine();
while(str.Length != 0)
{
//Escribimos en el FicheRo qe Creamoz
sw.WriteLine(str);
str=Console.ReadLine();
}
}
catch(IOException e)
{
Console.WriteLine("Error: "+e.Message);
}
finally
{
if(sw != null)
sw.Close();
}
}//Main
}// Class
Hola otra vez :D, estoy con la duda Creo qe dices abrir Word vdd no crear :¬¬
aqui esta otro ratuniaa aver sii esa si es la qe te sirve, si no, explica mas detalladamente para poder ayudarte...
echale a un ojo..
using System;
using System.Diagnostics;
using System.Threading;
namespace Process_Sample
{
class MyProcessClass
{
public static void Main(string [] args)
{
try
{
Process myProcess;
myProcess = Process.Start("winword.exe");
while(!myProcess.HasExited)
{
Console.WriteLine();
Console.WriteLine("Process's physical memory usage: " + myProcess.WorkingSet);
Console.WriteLine("Base priority of the associated process: " + myProcess.BasePriority);
Console.WriteLine("Priority class of the associated process: " + myProcess.PriorityClass);
Console.WriteLine("User Processor Time: " + myProcess.UserProcessorTime);
Console.WriteLine("Privileged Processor Time: " + myProcess.PrivilegedProcessorTime);
Console.WriteLine("Total Processor Time: " + myProcess.TotalProcessorTime);
Console.WriteLine("Process's Name: " + myProcess.ToString());
Console.WriteLine("-------------------------------------");
if(myProcess.Responding)
{
Console.WriteLine("Status: Responding to user interface");
myProcess.Refresh();
}
else
{
Console.WriteLine("Status: Not Responding");
}
Thread.Sleep(1000);
}
Console.WriteLine();
Console.WriteLine("Process exit code: {0}", myProcess.ExitCode);
}
catch(Exception e)
{
Console.WriteLine("The following exception was raised: " + e.Message);
}
}
}
}
Gracias por tu respuesta.
Bueno ... en principio necesitaba cargar el documento de word en la aplicacion, pero ahora hay cambio de planes :-( ;D m
bueno ... ahora estoy generando un archivo XML con los datos que necesito, y quiero usar esos datos para meterlos en un documento de word 07 y colocar esos datos en partes especificas del este docx ....
Necesitas Averiguiar sobre OpenXml
Atentamente,
Juan Manuel Lombana
Medellìn - Colombia
Esto lo puedes hacer sin tanto lio Usando Crystal Reports... investiga sobre el mismo, Saludos