Here my code:
using Excel = Microsoft.Office.Interop.Excel;
private void button1_Click(object sender, EventArgs e)
{
Excel.Application xlApp = new Excel.Application();
Excel.Workbook wb = xlApp.Workbooks.Add(System.Type.Missing);
Excel.Worksheet ws = (Excel.Worksheet)wb.Sheets[1];
xlApp.Visible = true;
Excel.Shape textBox = ws.Shapes.AddTextbox(
Microsoft.Office.Core.MsoTextOrientation.msoTextOrientationHorizontal,
10 + 10 + 10, 36, 600, 100);
textBox.TextFrame.Characters(System.Type.Missing, System.Type.Missing).Text
= "testing";
xlApp.ActiveWindow.Activate();
xlApp.UserControl = true;
ws = null;
wb = null;
xlApp = null;
}
But with this code I only can add one line text “testing”:
---------------------------------
|Testing |
| |
| |
---------------------------------
Now I want to add 3 line text, like this:
---------------------------------
|Test1 |
|Test2 |
|Test3 |
---------------------------------
Somebody help me?
System.Environment.NewLinemight be the constant you are looking for to separate your 3 strings.