We are developing a window form application with C#, and
part of its
function is to output the calculation results to MS Excel
sheet. In
order to handle the drastic case, we decided to modified
this function
to let it output the results to Notepad if MS Excel is
detected not
installed on the end user's machine (Nowsday it is really
hard to find
such machine). Now I can open a new session of Notepad from
the
application using the shell function, but I am not quite
confident of
how to write the results into this newly opened Notepad
session. Does
any one know if C# provide such built-in functionality to
handle the
Notepad or Wordpad as it is handling the Excel?
For example, I can write something like the following to
export to
Excel
private void cmdExport_Click(object sender, System.EventArgs
e)
{
Microsoft.Office.Interop.Excel.Application
excel = null;
Microsoft.Office.Interop.Excel.Workbook wb =
null;
Microsoft.Office.Interop.Excel.Worksheet ws =
null;
Microsoft.Office.Interop.Excel.Range rng =
null;
object missing = Type.Missing;
try
{
excel = new Microsoft.Office.Interop.Excel.Application();
wb = excel.Workbooks.Add(missing);
ws =
(Microsoft.Office.Interop.Excel.Worksheet)wb.ActiveSheet;
//write the border for the dataset
rng = ws.get_Range("B2",
"F26");
rng.BorderAround(missing, XlBorderWeight.xlThick,
XlColorIndex.xlColorIndexAutomatic, missing);
//Title line of the sheet
rng = ws.get_Range("B2", "F2");
rng.Cells.MergeCells = 5;
rng.Font.Bold = true;
rng.Font.Size = 16;
rng.Font.Name = "arial";
rng.Font.Italic = true;
rng.Font.Color = System.Drawing.Color.Blue.ToArgb();
rng.VerticalAlignment = XlVAlign.xlVAlignBottom;
rng.HorizontalAlignment = XlHAlign.xlHAlignCenter;
rng.BorderAround(missing, XlBorderWeight.xlThick,
XlColorIndex.xlColorIndexAutomatic, missing);
rng.Value2 = "Sand Bed Headcut and Tailcut
Profiles";
so what I am asking is that 'Does C# provide the similar
thing to
handle the output to Notepad or Wordpad?'
Thanks in advance for any help or suggestions.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "C-Sharp (C#)" group.
To post to this group, send email to C_Sharp googlegroups.com
To unsubscribe from this group, send email to
C_Sharp-unsubscribe googlegroups.com
For more options, visit this group at http://groups.
google.com/group/C_Sharp
-~----------~----~----~----~------~----~------~--~---
|