/// <summary> /// Convert Excel TextBox to Word TextBox /// </summary> /// <param name="excelTextBox">Excel TextBox</param> /// <param name="doc">Parent document</param> /// <returns>Word Shape</returns> private Aspose.Words.Drawing.Shape ConvertTextBoxToShape(Aspose.Cells.Drawing.TextBox excelTextBox, DocumentBase doc) { //Create a new TextBox Aspose.Words.Drawing.Shape wordsShape = new Aspose.Words.Drawing.Shape(doc, Aspose.Words.Drawing.ShapeType.TextBox); //Import TextBox properties inhereted from Shape ImportShapeProperties(wordsShape, (Shape)excelTextBox); //Import TextBox properties wordsShape.TextBox.LayoutFlow = ConvertDrawingTextOrientationType(excelTextBox.TextOrientationType); //Import text Run run = new Run(doc); if (!string.IsNullOrEmpty(excelTextBox.Text)) run.Text = excelTextBox.Text; else run.Text = string.Empty; //Import text formating ImportFont(run.Font, excelTextBox.Font); //Create paragraph Paragraph paragraph = new Paragraph(doc); //Import horizontal alignment paragraph.ParagraphFormat.Alignment = ConvertHorizontalAlignment(excelTextBox.TextHorizontalAlignment); //Insert text into the paragraph paragraph.AppendChild(run); //insert Pragraph into textbox wordsShape.AppendChild(paragraph); return wordsShape; }