//create a new workbook var workbook = new GrapeCity.Documents.Excel.Workbook(); // TEXTBEFORE Function Example IWorksheet sheetOfTEXTBEFORE = workbook.ActiveSheet; sheetOfTEXTBEFORE.Name = "TEXTBEFORE"; sheetOfTEXTBEFORE.Range["A1"].Value = "Data"; sheetOfTEXTBEFORE.Range["A1"].Font.Bold = true; sheetOfTEXTBEFORE.Range["A2"].Value = "Little Red Riding Hood's red hood"; sheetOfTEXTBEFORE.Range["A3"].Value = "Little red Riding Hood's red hood"; sheetOfTEXTBEFORE.Range["A4"].Value = "Formulas"; sheetOfTEXTBEFORE.Range["A4"].Font.Bold = true; sheetOfTEXTBEFORE.Range["B4"].Value = "Results"; sheetOfTEXTBEFORE.Range["B4"].Font.Bold = true; sheetOfTEXTBEFORE.Range["B5"].Formula2 = "=TEXTBEFORE(A2,\"Red\")"; sheetOfTEXTBEFORE.Range["A5"].Formula = "=FORMULATEXT(B5)"; sheetOfTEXTBEFORE.Range["B6"].Formula2 = "=TEXTBEFORE(A3,\"red\",2)"; sheetOfTEXTBEFORE.Range["A6"].Formula = "=FORMULATEXT(B6)"; sheetOfTEXTBEFORE.Range["B7"].Formula2 = "=TEXTBEFORE(A3,\"red\",-2)"; sheetOfTEXTBEFORE.Range["A7"].Formula = "=FORMULATEXT(B7)"; sheetOfTEXTBEFORE.Range["B8"].Formula2 = "=TEXTBEFORE(A3,\"Red\")"; sheetOfTEXTBEFORE.Range["A8"].Formula = "=FORMULATEXT(B8)"; sheetOfTEXTBEFORE.Range["B9"].Formula2 = "=TEXTBEFORE(A3,\"Red\",,1)"; sheetOfTEXTBEFORE.Range["A9"].Formula = "=FORMULATEXT(B9)"; sheetOfTEXTBEFORE.Range["B10"].Formula2 = "=TEXTBEFORE(A3,\"Riding\")"; sheetOfTEXTBEFORE.Range["A10"].Formula = "=FORMULATEXT(B10)"; sheetOfTEXTBEFORE.Columns[0].AutoFit(); sheetOfTEXTBEFORE.Columns[1].AutoFit(); // TEXTAFTER Function Example IWorksheet sheetOfTEXTAFTER = workbook.Worksheets.Add(); sheetOfTEXTAFTER.Name = "TEXTAFTER"; sheetOfTEXTAFTER.Range["A1"].Value = "Data"; sheetOfTEXTAFTER.Range["A1"].Font.Bold = true; sheetOfTEXTAFTER.Range["A2"].Value = "Little Red Riding Hood's red hood"; sheetOfTEXTAFTER.Range["A3"].Value = "Little red Riding Hood's red hood"; sheetOfTEXTAFTER.Range["A4"].Value = "Formulas"; sheetOfTEXTAFTER.Range["A4"].Font.Bold = true; sheetOfTEXTAFTER.Range["B4"].Value = "Results"; sheetOfTEXTAFTER.Range["B4"].Font.Bold = true; sheetOfTEXTAFTER.Range["B5"].Formula2 = "=TEXTAFTER(A2,\"Red\")"; sheetOfTEXTAFTER.Range["A5"].Formula = "=FORMULATEXT(B5)"; sheetOfTEXTAFTER.Range["B6"].Formula2 = "=TEXTAFTER(A3,\"red\",2)"; sheetOfTEXTAFTER.Range["A6"].Formula = "=FORMULATEXT(B6)"; sheetOfTEXTAFTER.Range["B7"].Formula2 = "=TEXTAFTER(A3,\"red\",-2)"; sheetOfTEXTAFTER.Range["A7"].Formula = "=FORMULATEXT(B7)"; sheetOfTEXTAFTER.Range["B8"].Formula2 = "=TEXTAFTER(A3,\"Red\")"; sheetOfTEXTAFTER.Range["A8"].Formula = "=FORMULATEXT(B8)"; sheetOfTEXTAFTER.Range["B9"].Formula2 = "=TEXTAFTER(A3,\"Red\",,1)"; sheetOfTEXTAFTER.Range["A9"].Formula = "=FORMULATEXT(B9)"; sheetOfTEXTAFTER.Range["B10"].Formula2 = "=TEXTAFTER(A3,\"Riding\")"; sheetOfTEXTAFTER.Range["A10"].Formula = "=FORMULATEXT(B10)"; sheetOfTEXTAFTER.Columns[0].AutoFit(); sheetOfTEXTAFTER.Columns[1].AutoFit(); // TEXTSPLIT Function Example IWorksheet sheetOfTEXTSPLIT = workbook.Worksheets.Add(); sheetOfTEXTSPLIT.Name = "TEXTSPLIT"; sheetOfTEXTSPLIT.Range["A1"].Value = "Data"; sheetOfTEXTSPLIT.Range["A1"].Font.Bold = true; sheetOfTEXTSPLIT.Range["A2"].Value = "Dakota Lennon Sanchez"; sheetOfTEXTSPLIT.Range["A3"].Value = "To be or not to be"; sheetOfTEXTSPLIT.Range["A4"].Value = "1,2,3;4,5,6"; sheetOfTEXTSPLIT.Range["A6"].Value = "Formulas"; sheetOfTEXTSPLIT.Range["A6"].Font.Bold = true; sheetOfTEXTSPLIT.Range["A7"].Value = "Results"; sheetOfTEXTSPLIT.Range["A7"].Font.Bold = true; sheetOfTEXTSPLIT.Range["B7"].Formula2 = "=TEXTSPLIT(A2,\" \")"; sheetOfTEXTSPLIT.Range["B6"].Formula = "=FORMULATEXT(B7)"; sheetOfTEXTSPLIT.Range["A9"].Value = "Formulas"; sheetOfTEXTSPLIT.Range["A9"].Font.Bold = true; sheetOfTEXTSPLIT.Range["A10"].Value = "Results"; sheetOfTEXTSPLIT.Range["A10"].Font.Bold = true; sheetOfTEXTSPLIT.Range["B10"].Formula2 = "=TEXTSPLIT(A3,\" \")"; sheetOfTEXTSPLIT.Range["B9"].Formula = "=FORMULATEXT(B10)"; sheetOfTEXTSPLIT.Range["A12"].Value = "Formulas"; sheetOfTEXTSPLIT.Range["A12"].Font.Bold = true; sheetOfTEXTSPLIT.Range["A13"].Value = "Results"; sheetOfTEXTSPLIT.Range["A13"].Font.Bold = true; sheetOfTEXTSPLIT.Range["B13"].Formula2 = "=TEXTSPLIT(A4,\",\",\";\")"; sheetOfTEXTSPLIT.Range["B12"].Formula = "=FORMULATEXT(B13)"; sheetOfTEXTSPLIT.Columns[0].AutoFit(); sheetOfTEXTSPLIT.Columns[1].AutoFit(); // Save to an excel file workbook.Save("NewTextManipulationFunctions.xlsx");
' Create a new Workbook Dim workbook As New Workbook ' TEXTBEFORE Function Example Dim sheetOfTEXTBEFORE As IWorksheet = workbook.ActiveSheet sheetOfTEXTBEFORE.Name = "TEXTBEFORE" sheetOfTEXTBEFORE.Range("A1").Value = "Data" sheetOfTEXTBEFORE.Range("A1").Font.Bold = True sheetOfTEXTBEFORE.Range("A2").Value = "Little Red Riding Hood's red hood" sheetOfTEXTBEFORE.Range("A3").Value = "Little red Riding Hood's red hood" sheetOfTEXTBEFORE.Range("A4").Value = "Formulas" sheetOfTEXTBEFORE.Range("A4").Font.Bold = True sheetOfTEXTBEFORE.Range("B4").Value = "Results" sheetOfTEXTBEFORE.Range("B4").Font.Bold = True sheetOfTEXTBEFORE.Range("B5").Formula2 = "=TEXTBEFORE(A2,""Red"")" sheetOfTEXTBEFORE.Range("A5").Formula = "=FORMULATEXT(B5)" sheetOfTEXTBEFORE.Range("B6").Formula2 = "=TEXTBEFORE(A3,""red"",2)" sheetOfTEXTBEFORE.Range("A6").Formula = "=FORMULATEXT(B6)" sheetOfTEXTBEFORE.Range("B7").Formula2 = "=TEXTBEFORE(A3,""red"",-2)" sheetOfTEXTBEFORE.Range("A7").Formula = "=FORMULATEXT(B7)" sheetOfTEXTBEFORE.Range("B8").Formula2 = "=TEXTBEFORE(A3,""Red"")" sheetOfTEXTBEFORE.Range("A8").Formula = "=FORMULATEXT(B8)" sheetOfTEXTBEFORE.Range("B9").Formula2 = "=TEXTBEFORE(A3,""Red"",,1)" sheetOfTEXTBEFORE.Range("A9").Formula = "=FORMULATEXT(B9)" sheetOfTEXTBEFORE.Range("B10").Formula2 = "=TEXTBEFORE(A3,""Riding"")" sheetOfTEXTBEFORE.Range("A10").Formula = "=FORMULATEXT(B10)" sheetOfTEXTBEFORE.Columns(0).AutoFit() sheetOfTEXTBEFORE.Columns(1).AutoFit() ' TEXTAFTER Function Example Dim sheetOfTEXTAFTER As IWorksheet = workbook.Worksheets.Add() sheetOfTEXTAFTER.Name = "TEXTAFTER" sheetOfTEXTAFTER.Range("A1").Value = "Data" sheetOfTEXTAFTER.Range("A1").Font.Bold = True sheetOfTEXTAFTER.Range("A2").Value = "Little Red Riding Hood's red hood" sheetOfTEXTAFTER.Range("A3").Value = "Little red Riding Hood's red hood" sheetOfTEXTAFTER.Range("A4").Value = "Formulas" sheetOfTEXTAFTER.Range("A4").Font.Bold = True sheetOfTEXTAFTER.Range("B4").Value = "Results" sheetOfTEXTAFTER.Range("B4").Font.Bold = True sheetOfTEXTAFTER.Range("B5").Formula2 = "=TEXTAFTER(A2,""Red"")" sheetOfTEXTAFTER.Range("A5").Formula = "=FORMULATEXT(B5)" sheetOfTEXTAFTER.Range("B6").Formula2 = "=TEXTAFTER(A3,""red"",2)" sheetOfTEXTAFTER.Range("A6").Formula = "=FORMULATEXT(B6)" sheetOfTEXTAFTER.Range("B7").Formula2 = "=TEXTAFTER(A3,""red"",-2)" sheetOfTEXTAFTER.Range("A7").Formula = "=FORMULATEXT(B7)" sheetOfTEXTAFTER.Range("B8").Formula2 = "=TEXTAFTER(A3,""Red"")" sheetOfTEXTAFTER.Range("A8").Formula = "=FORMULATEXT(B8)" sheetOfTEXTAFTER.Range("B9").Formula2 = "=TEXTAFTER(A3,""Red"",,1)" sheetOfTEXTAFTER.Range("A9").Formula = "=FORMULATEXT(B9)" sheetOfTEXTAFTER.Range("B10").Formula2 = "=TEXTAFTER(A3,""Riding"")" sheetOfTEXTAFTER.Range("A10").Formula = "=FORMULATEXT(B10)" sheetOfTEXTAFTER.Columns(0).AutoFit() sheetOfTEXTAFTER.Columns(1).AutoFit() ' TEXTSPLIT Function Example Dim sheetOfTEXTSPLIT As IWorksheet = workbook.Worksheets.Add() sheetOfTEXTSPLIT.Name = "TEXTSPLIT" sheetOfTEXTSPLIT.Range("A1").Value = "Data" sheetOfTEXTSPLIT.Range("A1").Font.Bold = True sheetOfTEXTSPLIT.Range("A2").Value = "Dakota Lennon Sanchez" sheetOfTEXTSPLIT.Range("A3").Value = "To be or not to be" sheetOfTEXTSPLIT.Range("A4").Value = "1,2,3;4,5,6" sheetOfTEXTSPLIT.Range("A6").Value = "Formulas" sheetOfTEXTSPLIT.Range("A6").Font.Bold = True sheetOfTEXTSPLIT.Range("A7").Value = "Results" sheetOfTEXTSPLIT.Range("A7").Font.Bold = True sheetOfTEXTSPLIT.Range("B7").Formula2 = "=TEXTSPLIT(A2,"" "")" sheetOfTEXTSPLIT.Range("B6").Formula = "=FORMULATEXT(B7)" sheetOfTEXTSPLIT.Range("A9").Value = "Formulas" sheetOfTEXTSPLIT.Range("A9").Font.Bold = True sheetOfTEXTSPLIT.Range("A10").Value = "Results" sheetOfTEXTSPLIT.Range("A10").Font.Bold = True sheetOfTEXTSPLIT.Range("B10").Formula2 = "=TEXTSPLIT(A3,"" "")" sheetOfTEXTSPLIT.Range("B9").Formula = "=FORMULATEXT(B10)" sheetOfTEXTSPLIT.Range("A12").Value = "Formulas" sheetOfTEXTSPLIT.Range("A12").Font.Bold = True sheetOfTEXTSPLIT.Range("A13").Value = "Results" sheetOfTEXTSPLIT.Range("A13").Font.Bold = True sheetOfTEXTSPLIT.Range("B13").Formula2 = "=TEXTSPLIT(A4,"","","";"")" sheetOfTEXTSPLIT.Range("B12").Formula = "=FORMULATEXT(B13)" sheetOfTEXTSPLIT.Columns(0).AutoFit() sheetOfTEXTSPLIT.Columns(1).AutoFit() ' save to an excel file workbook.Save("NewTextManipulationFunctions.xlsx")