static void Main(string[] args) { string filePath = Path.GetDirectoryName(Path.GetDirectoryName(Directory.GetCurrentDirectory())) + @"\data\" + "Working with Headers.doc"; // Check for license and apply if exists string licenseFile = AppDomain.CurrentDomain.BaseDirectory + "Aspose.Words.lic"; if (File.Exists(licenseFile)) { // Apply Aspose.Words API License Aspose.Words.License license = new Aspose.Words.License(); // Place license file in Bin/Debug/ Folder license.SetLicense("Aspose.Words.lic"); } Document wordDocument = new Document(filePath); HeaderFooterCollection headers = wordDocument.FirstSection.HeadersFooters; foreach (HeaderFooter header in headers) { if (header.HeaderFooterType == HeaderFooterType.HeaderFirst || header.HeaderFooterType == HeaderFooterType.HeaderPrimary || header.HeaderFooterType == HeaderFooterType.HeaderEven) { Console.WriteLine(header.GetText()); } } }
/// <summary> /// Initialize for mapping manager /// </summary> /// <param name="manager">Mapping manager</param> /// <param name="ignoreBlobs">Flag to ingore blob pointer</param> private static void Initialize(string[] args) { // // Configure logservice LogService.Initialize(typeof(Program)); // // Apose license Aspose.Words.License word = new Aspose.Words.License(); word.SetLicense("Aspose.Total.lic"); Aspose.Cells.License excel = new Aspose.Cells.License(); excel.SetLicense("Aspose.Total.lic"); // // Configure blob pointer bool ignoreBlobs = false; if (args.Contains("/ignore-blobs")) { ignoreBlobs = true; } ManualMapping.IgnoreBlobs = ignoreBlobs; }
static void Main(string[] args) { // Check for license and apply if exists string licenseFile = AppDomain.CurrentDomain.BaseDirectory + "Aspose.Words.lic"; if (File.Exists(licenseFile)) { // Apply Aspose.Words API License Aspose.Words.License license = new Aspose.Words.License(); // Place license file in Bin/Debug/ Folder license.SetLicense("Aspose.Words.lic"); } string filePath = Path.GetDirectoryName(Path.GetDirectoryName(Directory.GetCurrentDirectory())) + @"\data\" + "Extract Images from Word Document.doc"; Document wordDocument = new Document(filePath); NodeCollection pictures = wordDocument.GetChildNodes(NodeType.Shape, true); int imageindex = 0; foreach (Shape shape in pictures) { string imageType = FileFormatUtil.ImageTypeToExtension(shape.ImageData.ImageType); if (shape.HasImage) { string imageFileName = "Aspose_" + (imageindex++).ToString() + "_" + shape.Name + imageType; shape.ImageData.Save(imageFileName); } } }
protected void Application_Start() { var Key = db.Database.SqlQuery <SYS_CONFIG>("SELECT * FROM SYS_CONFIG WHERE CONFIG_ID = 11").FirstOrDefault(); Aspose.Words.License wordsLicense = new Aspose.Words.License(); wordsLicense.SetLicense(@"" + Key.CONFIG_VALUE); Aspose.Cells.License cellsLicense = new Aspose.Cells.License(); cellsLicense.SetLicense(@"" + Key.CONFIG_VALUE); Aspose.Pdf.License pdfLicense = new Aspose.Pdf.License(); pdfLicense.SetLicense(@"" + Key.CONFIG_VALUE); Aspose.Tasks.License TaskLicense = new Aspose.Tasks.License(); TaskLicense.SetLicense(@"" + Key.CONFIG_VALUE); //AreaRegistration.RegisterAllAreas(); //WebApiConfig.Register(GlobalConfiguration.Configuration); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); //BundleConfig.RegisterBundles(BundleTable.Bundles); }
protected void Application_Start() { // Init Aspose.Words license var license = new Aspose.Words.License(); license.SetLicense("Aspose.Words.lic"); log4net.Config.XmlConfigurator.Configure(); DependencyResolverInitializer.Initialize(); AreaRegistration.RegisterAllAreas(); GlobalConfiguration.Configure(WebApiConfig.Register); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); RegisterGlobalFilters(GlobalFilters.Filters); //GlobalConfiguration.Configuration.Filters.Add(new ElmahHandleErrorApiAttribute()); //RegisterRoutes(RouteTable.Routes); ModelBinders.Binders.DefaultBinder = new SharpModelBinder(); ModelBinders.Binders.Add(typeof(Money), new MoneyBinder()); }
static void Main(string[] args) { // Check for license, and apply if it exists. string licenseFile = AppDomain.CurrentDomain.BaseDirectory + "Aspose.Words.lic"; if (File.Exists(licenseFile)) { // Apply Aspose.Words API License. Aspose.Words.License license = new Aspose.Words.License(); // Place license file in Bin/Debug/ Folder. license.SetLicense("Aspose.Words.lic"); } Document doc = new Document(); DocumentBuilder builder = new DocumentBuilder(doc); builder.ParagraphFormat.Borders.Top.LineStyle = LineStyle.Thick; builder.ParagraphFormat.Shading.BackgroundPatternColor = System.Drawing.ColorTranslator.FromHtml("#EEEEEE"); builder.ParagraphFormat.Shading.Texture = TextureIndex.TextureDarkDiagonalUp; builder.Writeln("Title1"); builder.ParagraphFormat.ClearFormatting(); builder.InsertBreak(BreakType.ParagraphBreak); // Call this method to start building the table. builder.StartTable(); builder.InsertCell(); builder.CellFormat.Shading.BackgroundPatternColor = System.Drawing.ColorTranslator.FromHtml("#FF0000"); builder.Font.Position = 100; builder.Font.Name = "Courier"; builder.Font.Bold = true; builder.Font.Underline = Underline.DotDotDash; builder.Write("The quick brown fox"); builder.InsertCell(); builder.Font.ClearFormatting(); builder.CellFormat.ClearFormatting(); builder.InsertCell(); builder.EndRow(); builder.InsertCell(); builder.InsertCell(); builder.Write("EXAMPLE OF TABLE"); builder.InsertCell(); builder.EndRow(); builder.InsertCell(); builder.InsertCell(); builder.InsertCell(); builder.Write("only text"); builder.EndRow(); // Signal that we have finished building the table. builder.EndTable(); doc.Save("SimpleTableAspose.docx"); }
protected ComposerBase(IBuilderBase builder, IGatherData gatherData, ISavePDF savePDF) { Aspose.Words.License license = new Aspose.Words.License(); license.SetLicense("Aspose.Words.lic"); _builder = builder; _gatherData = gatherData; _savePDF = savePDF; }
/// <summary> /// Load liencse for apose /// </summary> private static void LicenseAspose() { Aspose.Words.License word = new Aspose.Words.License(); word.SetLicense("Aspose.Total.lic"); Aspose.Cells.License excel = new Aspose.Cells.License(); excel.SetLicense("Aspose.Total.lic"); }
static void Main(string[] args) { // Check for license and apply if exists string licenseFile = AppDomain.CurrentDomain.BaseDirectory + "Aspose.Words.lic"; if (File.Exists(licenseFile)) { // Apply Aspose.Words API License Aspose.Words.License license = new Aspose.Words.License(); // Place license file in Bin/Debug/ Folder license.SetLicense("Aspose.Words.lic"); } Document doc = new Document(); DocumentBuilder builder = new DocumentBuilder(doc); builder.Font.Bold = true; builder.Font.Name = "Courier"; builder.Font.Size = 12; builder.Writeln("simple bullet"); builder.Font.ClearFormatting(); builder.ListFormat.List = doc.Lists.Add(Aspose.Words.Lists.ListTemplate.BulletSquare); builder.Writeln("first, create paragraph and run, set text"); builder.Writeln("second, call XWPFDocument.CreateNumbering() to create numbering"); builder.Writeln("third, add AbstractNum[numbering.AddAbstractNum()] and Num(numbering.AddNum(abstractNumId))"); builder.Writeln("next, call XWPFParagraph.SetNumID(numId) to set paragraph property, CT_P.pPr.numPr"); builder.ListFormat.RemoveNumbers(); builder.InsertBreak(BreakType.ParagraphBreak); //multi level builder.Font.Bold = true; builder.Font.Name = "Courier"; builder.Font.Size = 12; builder.Writeln("multi level bullet"); builder.Font.ClearFormatting(); builder.ListFormat.List = doc.Lists.Add(Aspose.Words.Lists.ListTemplate.BulletSquare); builder.Writeln("first"); builder.ListFormat.ListLevelNumber = 1; builder.Writeln("first-first"); builder.Writeln("first-second"); builder.Writeln("first-third"); builder.ListFormat.List = doc.Lists.Add(Aspose.Words.Lists.ListTemplate.BulletSquare); builder.ListFormat.ListLevelNumber = 0; builder.Writeln("second"); builder.ListFormat.ListLevelNumber = 1; builder.Writeln("second-first"); builder.Writeln("second-second"); builder.Writeln("second-third"); builder.ListFormat.ListLevelNumber = 2; builder.Writeln("second-third-first"); builder.Writeln("second-third-second"); builder.ListFormat.List = doc.Lists.Add(Aspose.Words.Lists.ListTemplate.BulletSquare); builder.ListFormat.ListLevelNumber = 0; builder.Writeln("third"); builder.ListFormat.RemoveNumbers(); doc.Save("CreateBulletAspose.docx"); }
private static void RegistrarAspose() { var licenceTotalPath = @"Licenses/Aspose.Total.lic"; var asposeCellsLicense = new Aspose.Cells.License(); var asposeWordLicense = new Aspose.Words.License(); asposeCellsLicense.SetLicense(licenceTotalPath); asposeWordLicense.SetLicense(licenceTotalPath); }
static void Main(string[] args) { // Check for license and apply if exists string licenseFile = AppDomain.CurrentDomain.BaseDirectory + "Aspose.Words.lic"; if (File.Exists(licenseFile)) { // Apply Aspose.Words API License Aspose.Words.License license = new Aspose.Words.License(); // Place license file in Bin/Debug/ Folder license.SetLicense("Aspose.Words.lic"); } Document doc = new Document(); DocumentBuilder builder = new DocumentBuilder(doc); Table table = builder.StartTable(); builder.InsertCell(); // Set the borders for the entire table. table.SetBorders(LineStyle.Single, 2.0, Color.Black); // Set the cell shading for this cell. builder.CellFormat.Shading.BackgroundPatternColor = Color.DarkGray; builder.Writeln("Cell #1"); builder.InsertCell(); // Specify a different cell shading for the second cell. builder.CellFormat.Shading.BackgroundPatternColor = Color.Blue; builder.Writeln("Cell #2"); // End this row. builder.EndRow(); // Clear the cell formatting from previous operations. builder.CellFormat.ClearFormatting(); // Create the second row. builder.InsertCell(); // Create larger borders for the first cell of this row. This will be different // compared to the borders set for the table. builder.CellFormat.Borders.Left.LineWidth = 4.0; builder.CellFormat.Borders.Right.LineWidth = 4.0; builder.CellFormat.Borders.Top.LineWidth = 4.0; builder.CellFormat.Borders.Bottom.LineWidth = 4.0; builder.Writeln("Cell #3"); builder.InsertCell(); // Clear the cell formatting from the previous cell. builder.CellFormat.ClearFormatting(); builder.Writeln("Cell #4"); doc.Save("Format Table in Document.doc"); }
static void Main(string[] args) { // Check for license and apply if exists string licenseFile = AppDomain.CurrentDomain.BaseDirectory + "Aspose.Words.lic"; if (File.Exists(licenseFile)) { // Apply Aspose.Words API License Aspose.Words.License license = new Aspose.Words.License(); // Place license file in Bin/Debug/ Folder license.SetLicense("Aspose.Words.lic"); } Document doc = new Document(); DocumentBuilder builder = new DocumentBuilder(doc); Table table = builder.StartTable(); builder.InsertCell(); // Set the borders for the entire table. table.SetBorders(LineStyle.Single, 2.0, Color.Black); // Set the cell shading for this cell. builder.CellFormat.Shading.BackgroundPatternColor = Color.DarkGray; builder.Writeln("Cell #1"); builder.InsertCell(); // Specify a different cell shading for the second cell. builder.CellFormat.Shading.BackgroundPatternColor=Color.Blue; builder.Writeln("Cell #2"); // End this row. builder.EndRow(); // Clear the cell formatting from previous operations. builder.CellFormat.ClearFormatting(); // Create the second row. builder.InsertCell(); // Create larger borders for the first cell of this row. This will be different // compared to the borders set for the table. builder.CellFormat.Borders.Left.LineWidth=4.0; builder.CellFormat.Borders.Right.LineWidth=4.0; builder.CellFormat.Borders.Top.LineWidth=4.0; builder.CellFormat.Borders.Bottom.LineWidth=4.0; builder.Writeln("Cell #3"); builder.InsertCell(); // Clear the cell formatting from the previous cell. builder.CellFormat.ClearFormatting(); builder.Writeln("Cell #4"); doc.Save("Format Table in Document.doc"); }
protected void Application_Start() { Aspose.Words.License license = new Aspose.Words.License(); //MemoryStream stream = new MemoryStream(File.ReadAllBytes(@"Aspose.Words.lic")); license.SetLicense(@"Aspose.Words.lic"); AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); }
internal static void SetUnlimitedLicense() { if (File.Exists(TestLicenseFileName)) { // This shows how to use an Aspose.Words license when you have purchased one. // You don't have to specify full path as shown here. You can specify just the // file name if you copy the license file into the same folder as your application // binaries or you add the license to your project as an embedded resource. Aspose.Words.License license = new Aspose.Words.License(); license.SetLicense(TestLicenseFileName); } }
///<Summary> /// SetAsposeWordsLicense method to Aspose.Words License ///</Summary> public static void SetAsposeWordsLicense() { try { Aspose.Words.License awLic = new Aspose.Words.License(); awLic.SetLicense(_licenseFileName); } catch (Exception ex) { Console.WriteLine(ex.Message); } }
private static void License() { try { const string licName = "Aspose.Total.lic"; var wlic = new Aspose.Words.License(); wlic.SetLicense(licName); } catch (Exception ex) { Logs.Error("WordHelper License Exception : " + ex.ToString()); } }
static void Main(string[] args) { foreach (var process in Process.GetProcessesByName("AcroRd32")) { process.Kill(); } using var fileStream = File.Open("D:\\WorkAsposeFiles\\License.txt", FileMode.Open); var pdf = new Aspose.Pdf.License(); pdf.SetLicense(fileStream); fileStream.Seek(0, SeekOrigin.Begin); var word = new Aspose.Words.License(); word.SetLicense(fileStream); fileStream.Seek(0, SeekOrigin.Begin); var cells = new Aspose.Cells.License(); cells.SetLicense(fileStream); var model = new SkuPdfModel() { Characteristics = new List <Characteristic> { new Characteristic("Количество листов в пачке", "45 шт"), new Characteristic("Класс бумаги", "C"), new Characteristic("Плотность бумаги", "80 гр/м2"), new Characteristic("Страна происхождения", "Россия") }, Classifications = new List <Classification> { new Classification("ОКПД2", "32.99.12.120 Ручки и маркеры с наконечником из фетра и прочих пористых материалов"), new Classification("КПГЗ", "01.15.05.03.04 Принадлежности для досок и флипчартов"), new Classification("КТРУ", "32.99.12.120-00000001 Маркер") }, SupplierOffers = new List <SupplierOffer> { new SupplierOffer("ООО \"ЯСТРЕБ\"", "5427713792", "1219511-21", "5-10 дней", "г Москва, обл Московская", 47, 20), new SupplierOffer("ИП ВЛАДИМИР", "4767898456", "4578548-45", "2-3 часа", "г Казань, Татарстан", 30, 20), new SupplierOffer("ООО \"ЖЕНЕРИК\"", "7894598723", "6578459-12", "1-2 недели", "г Москва, обл Московская", 50, 20) } }; CreateTemplate(model); Process.Start("D:\\WorkAsposeFiles\\template.pdf"); }
public static void createFileDownload(string reportTemplate, DataSet reportData, string saveName, Aspose.Words.SaveFormat saveFormat, Aspose.Words.SaveType saveType, HttpResponse Response) { Aspose.Words.License license = new Aspose.Words.License(); license.SetLicense("Aspose.Words.lic"); //Open the template document Aspose.Words.Document reportDoc = new Aspose.Words.Document(reportTemplate); // Fill the fields in the document with user data. reportDoc.MailMerge.ExecuteWithRegions(reportData); // Send the document in Word format to the client browser with an option to save to disk or open inside the current browser. reportDoc.Save(saveName, saveFormat, saveType, Response); }
public ServiceOcrTecnodim() { Aspose.Words.License license = new Aspose.Words.License(); license.SetLicense(new FileStream(@"C:\Users\leonardo.domeneghett\Desktop\TECNODIM\TecnoDimOcr\TecnoDimOcr\Aspose\Aspose.Words.lic", FileMode.OpenOrCreate)); Aspose.Words.Document document = new Aspose.Words.Document(@"C:\Users\leonardo.domeneghett\Desktop\DOCS VERA CRUZ\BAVK\Tabela_Cabesp2016.xlsx"); var asasa = document.GetText(); File.AppendAllText(@"C:\Users\leonardo.domeneghett\Desktop\DOCS VERA CRUZ\teste1.txt", asasa); oGdPicturePDF.SetLicenseNumber("4118106456693265856441854"); oGdPictureImaging.SetLicenseNumber("4118106456693265856441854"); InitializeComponent(); this.ServiceName = "ServiceOcrTecnodim"; }
protected void Application_Start() { ViewEngines.Engines.Clear(); ViewEngines.Engines.Add(new RazorViewEngine()); AreaRegistration.RegisterAllAreas(); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); Aspose.Words.License license = new Aspose.Words.License(); license.SetLicense(ConfigurationManager.AppSettings["AsposeLicFileName"].ToString()); log4net.Config.XmlConfigurator.Configure(); }
public static void License() { string licensePath = System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase + "\\Aspose.Total.lic"; Aspose.Pdf.License pdf_license = new Aspose.Pdf.License(); pdf_license.SetLicense(licensePath); Aspose.Words.License word_license = new Aspose.Words.License(); word_license.SetLicense(licensePath); Aspose.Cells.License excel_license = new Aspose.Cells.License(); excel_license.SetLicense(licensePath); Aspose.Slides.License ppt_license = new Aspose.Slides.License(); ppt_license.SetLicense(licensePath); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); GlobalConfiguration.Configure(WebApiConfig.Register); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); AutoMapperConfig.CreateMappings(); //设置系统版本 SystemVersion = SysUtils.GetDllVersion(); Initialize(); Aspose.Words.License license = new Aspose.Words.License(); license.SetLicense("Aspose.Words.lic"); }
public static void Main(string[] args) { string rootdir = Directory.GetCurrentDirectory(); //Read Configuration from appSettings var config = new ConfigurationBuilder() .AddJsonFile("appsettings.json") .Build(); try { //Aspoe-Excel Aspose.Cells.License cellLicense = new Aspose.Cells.License(); string filePath = rootdir + "\\Resources\\" + "Aspose.Total.lic"; FileStream fileStream = new FileStream(filePath, FileMode.Open); cellLicense.SetLicense(fileStream); fileStream.Close(); //Aspoe-Pdf Aspose.Pdf.License pdfLicense = new Aspose.Pdf.License(); FileStream fileStreampdf = new FileStream(filePath, FileMode.Open); pdfLicense.SetLicense(fileStreampdf); fileStreampdf.Close(); //Aspoe-Word Aspose.Words.License wordLicense = new Aspose.Words.License(); FileStream fileStreamword = new FileStream(filePath, FileMode.Open); wordLicense.SetLicense(fileStreamword); fileStreamword.Close(); //Initialize Logger Log.Logger = new LoggerConfiguration() .ReadFrom.Configuration(config) .CreateLogger(); Log.Information("DFPS Application Starting......................."); //Test t = new Test(); //CSharpLab.Test(); CreateHostBuilder(args).Build().Run(); } catch (Exception ex) { Log.Fatal(ex, "Application start-up failed"); } finally { Log.CloseAndFlush(); } }
private void RegisterLicenses() { string licenseAsposeWordPath = Server.MapPath("~/Licenses/Aspose.Words.lic"); if (System.IO.File.Exists(licenseAsposeWordPath)) { Aspose.Words.License licenseWord = new Aspose.Words.License(); licenseWord.SetLicense(licenseAsposeWordPath); } string licenseAsposePdfPath = Server.MapPath("~/Licenses/Aspose.Pdf.lic"); if (System.IO.File.Exists(licenseAsposePdfPath)) { Aspose.Pdf.License licensePdf = new Aspose.Pdf.License(); licensePdf.SetLicense(licenseAsposePdfPath); } }
static void Main() { using (MemoryStream licdata = new MemoryStream(Properties.Resources.Aspose_Total)) { licdata.Seek(0, SeekOrigin.Begin); Aspose.Words.License word_lic = new Aspose.Words.License(); word_lic.SetLicense(licdata); licdata.Seek(0, SeekOrigin.Begin); Aspose.Cells.License cell_lic = new Aspose.Cells.License(); cell_lic.SetLicense(licdata); } Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new MainForm()); }
protected void btnIssueFreeFormatMessage_Click(object sender, EventArgs e) { Aspose.Words.License license = new Aspose.Words.License(); license.SetLicense("Aspose.Words.lic"); //Open template string path = Context.Server.MapPath("~/DesktopModules/TrainingCoreBanking/BankProject/Report/Template/IssueFreeFormatMessage.doc"); //Open the template document Aspose.Words.Document doc = new Aspose.Words.Document(path); //Execute the mail merge. DataSet ds = new DataSet(); ds = SQLData.B_BFREETEXTMESSAGE_Report(hiddenId.Value); // Fill the fields in the document with user data. doc.MailMerge.ExecuteWithRegions(ds); //moas mat thoi jan voi cuc gach nay woa // Send the document in Word format to the client browser with an option to save to disk or open inside the current browser. doc.Save("IssueFreeFormatMessage_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".pdf", Aspose.Words.SaveFormat.Pdf, Aspose.Words.SaveType.OpenInApplication, Response); }
static void Main(string[] args) { Aspose.Words.License license = new Aspose.Words.License(); license.SetLicense(@"c:\temp\Aspose.Total.lic"); // Problem One - inconsistent finding of <<&foreach tags based on position in document range // This seems to be entirely dependent on how the document was edited and how the runs / paragraphs fall // as to whether it finds the tags or not // Working document DocumentMerge merge = new DocumentMerge(); merge.Initialise(@"Documents\WorkingExpansion\WorkingExpansion.docx", @"Documents\WorkingExpansion\InputData.xml", @"Documents\WorkingExpansion\OutputDocument.docx"); // Expand any ForEach blocks in the Document merge.ProcessIterativeMarkup(); merge.CompiledDoc.Save(@"Documents\WorkingExpansion\ExpansionComplete.docx"); // None working document - only difference is the position of the opening foreach tag // but *both* tags are now not expanded merge = new DocumentMerge(); merge.Initialise(@"Documents\NoneWorkingExpansion\NoneWorkingExpansion.docx", @"Documents\NoneWorkingExpansion\InputData.xml", @"Documents\NoneWorkingExpansion\OutputDocument.docx"); // Expand any ForEach blocks in the Document merge.ProcessIterativeMarkup(); merge.CompiledDoc.Save(@"Documents\NoneWorkingExpansion\ExpansionComplete.docx"); // Problem Two - Removing Content between two fields merge = new DocumentMerge(); merge.Initialise(@"Documents\RemoveExcludedContent\InputDocument.docx", @"Documents\RemoveExcludedContent\InputData.xml", @"Documents\RemoveExcludedContent\OutputDocument.docx"); // Replace the Field markers with the XML data, creating unique tag id's merge.MergeFields(); merge.CompiledDoc.Save(@"Documents\RemoveExcludedContent\MergeComplete.docx"); // Remove the sections that should be removed merge.RemoveExcludedContent(); merge.CompiledDoc.Save(@"Documents\RemoveExcludedContent\RemovalComplete.docx"); // Note that the Second section has gone wrong - the Bold "s" is missing }
public static void Run() { //ExStart:ApplyLicenseFromStream Aspose.Words.License license = new Aspose.Words.License(); try { // Initializes a license from a stream MemoryStream stream = new MemoryStream(File.ReadAllBytes(@"Aspose.Words.lic")); license.SetLicense(stream); Console.WriteLine("License set successfully."); } catch (Exception e) { // We do not ship any license with this example, visit the Aspose site to obtain either a temporary or permanent license. Console.WriteLine("\nThere was an error setting the license: " + e.Message); } //ExEnd:ApplyLicenseFromStream }
/// <summary> /// Set license here /// </summary> public static void SetLicense() { // Path to license file String licFile = @"d:\data\aspose\lic\Aspose.Total.lic"; // Set the license, if not already set if (isLicSet == false)// { try { Aspose.Words.License licWords = new Aspose.Words.License(); licWords.SetLicense(licFile); Console.WriteLine("License set."); } catch(Exception ex) { Console.WriteLine("License NOT set."); } } }
/// <summary> /// Set license here /// </summary> public static void SetLicense() { // Path to license file String licFile = @"d:\data\aspose\lic\Aspose.Total.lic"; // Set the license, if not already set if (isLicSet == false)// { try { Aspose.Words.License licWords = new Aspose.Words.License(); licWords.SetLicense(licFile); Console.WriteLine("License set."); } catch (Exception ex) { Console.WriteLine("License NOT set."); } } }
static void Main(string[] args) { // Check for license and apply if exists. string licenseFile = AppDomain.CurrentDomain.BaseDirectory + "Aspose.Words.lic"; if (File.Exists(licenseFile)) { // Apply Aspose.Words API License. Aspose.Words.License license = new Aspose.Words.License(); // Place license file in Bin/Debug/ Folder. license.SetLicense("Aspose.Words.lic"); } Document doc = new Document(); DocumentBuilder builder = new DocumentBuilder(doc); builder.Writeln("Hello world!"); builder.InsertImage("../../image/Logo.jpg", 400, 400); doc.Save("InsertPicturesInWordAspose.docx"); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); Stream stream = new MemoryStream(StrToByteArray(Resource.Licence)); stream.Position = 0; Aspose.Pdf.License licensePdf = new Aspose.Pdf.License(); Aspose.Words.License licenseWords = new Aspose.Words.License(); licensePdf.SetLicense(stream); stream.Position = 0; licenseWords.SetLicense(stream); stream.Close(); LogHelper.InitLogger(); LogHelper.Log.Info("Application Start"); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); ModelBinders.Binders.Add(typeof(DateTime), new CustomDateBinder()); ModelBinders.Binders.Add(typeof(DateTime?), new NullableCustomDateBinder()); Stream stream = new MemoryStream(StrToByteArray(Resources.Licence)); stream.Position = 0; Aspose.Pdf.License licensePdf = new Aspose.Pdf.License(); Aspose.Words.License licenseWords = new Aspose.Words.License(); Aspose.Cells.License licenseCells = new Aspose.Cells.License(); Aspose.Slides.License licenseSlides = new Aspose.Slides.License(); Aspose.BarCode.License licenseBarCode = new Aspose.BarCode.License(); licensePdf.SetLicense(stream); stream.Position = 0; licenseWords.SetLicense(stream); stream.Position = 0; licenseCells.SetLicense(stream); stream.Position = 0; licenseSlides.SetLicense(stream); stream.Position = 0; licenseBarCode.SetLicense(stream); stream.Close(); // CreateLogins(); // CheckLogins(); LogHelper.InitLogger(); LogHelper.Log.Info("Application Start"); EmployePermissionHelper.Init(); QScheduler.Start(); }
static void Main(string[] args) { string filePath = Path.GetDirectoryName(Path.GetDirectoryName(Directory.GetCurrentDirectory())) + @"\data\" + "Working with Headers.doc"; // Check for license and apply if exists string licenseFile = AppDomain.CurrentDomain.BaseDirectory + "Aspose.Words.lic"; if (File.Exists(licenseFile)) { // Apply Aspose.Words API License Aspose.Words.License license = new Aspose.Words.License(); // Place license file in Bin/Debug/ Folder license.SetLicense("Aspose.Words.lic"); } Document wordDocument = new Document(filePath); HeaderFooterCollection headers = wordDocument.FirstSection.HeadersFooters; foreach (HeaderFooter header in headers) { if (header.HeaderFooterType == HeaderFooterType.HeaderFirst || header.HeaderFooterType == HeaderFooterType.HeaderPrimary || header.HeaderFooterType == HeaderFooterType.HeaderEven) Console.WriteLine(header.GetText()); } }
static void Main(string[] args) { string filePath = Path.GetDirectoryName(Path.GetDirectoryName(Directory.GetCurrentDirectory())) + @"\data\" + "Get Document Properties.doc"; // Check for license and apply if exists string licenseFile = AppDomain.CurrentDomain.BaseDirectory + "Aspose.Words.lic"; if (File.Exists(licenseFile)) { // Apply Aspose.Words API License Aspose.Words.License license = new Aspose.Words.License(); // Place license file in Bin/Debug/ Folder license.SetLicense("Aspose.Words.lic"); } Document doc = new Document(filePath); foreach (DocumentProperty prop in doc.BuiltInDocumentProperties) { Console.WriteLine(prop.Name+": "+ prop.Value); } }
static void Main(string[] args) { string filePath = Path.GetDirectoryName(Path.GetDirectoryName(Directory.GetCurrentDirectory())) + @"\data\" + "Get Document Properties.doc"; // Check for license and apply if exists string licenseFile = AppDomain.CurrentDomain.BaseDirectory + "Aspose.Words.lic"; if (File.Exists(licenseFile)) { // Apply Aspose.Words API License Aspose.Words.License license = new Aspose.Words.License(); // Place license file in Bin/Debug/ Folder license.SetLicense("Aspose.Words.lic"); } Document doc = new Document(filePath); foreach (DocumentProperty prop in doc.BuiltInDocumentProperties) { Console.WriteLine(prop.Name + ": " + prop.Value); } }
private void PrintSavingAccDocument() { Aspose.Words.License license = new Aspose.Words.License(); license.SetLicense("Aspose.Words.lic"); //Open template string docPath = Context.Server.MapPath("~/DesktopModules/TrainingCoreBanking/BankProject/Report/Template/SavingAcc/SavingAccount.docx"); //Open the template document Aspose.Words.Document document = new Aspose.Words.Document(docPath); //Execute the mail merge. var ds = PrepareData2Print(); // Fill the fields in the document with user data. document.MailMerge.ExecuteWithRegions(ds.Tables["Info"]); document.MailMerge.ExecuteWithRegions(ds.Tables["Items"]); // Send the document in Word format to the client browser with an option to save to disk or open inside the current browser. document.Save("SavingAccount_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".doc", Aspose.Words.SaveFormat.Doc, Aspose.Words.SaveType.OpenInBrowser, Response); }
/// <summary> /// Save word Report as pdf /// </summary> /// <param name="ms"></param> /// <param name="certificatePath"></param> public static void SaveWordReportAsPdf(MemoryStream ms, string certificatePath) { try { ms.Position = 0; //****By requirements definition. The reports originally made in Word are saved as Pdf Aspose.Words.License license = new Aspose.Words.License(); license.SetLicense("Aspose.Words.lic"); Aspose.Words.Document d = new Aspose.Words.Document(ms); ms.Close(); using (System.IO.MemoryStream asposeStream = new System.IO.MemoryStream()) { d.Save(asposeStream, Aspose.Words.SaveFormat.Pdf); asposeStream.Position = 0; byte[] bytes = new byte[asposeStream.Length]; asposeStream.Read(bytes, 0, System.Convert.ToInt32(asposeStream.Length)); //****End requirement definition using (System.IO.FileStream fs = System.IO.File.Create(certificatePath.Replace(".docx", ".pdf"))) asposeStream.WriteTo(fs); } } catch (Exception) { throw; } }
private static void LoadLicense(string ext) { switch (ext) { case ".PDF": var pdfLicense = new Aspose.Pdf.License(); pdfLicense.SetLicense("Aspose.Total.lic"); break; case ".DOC": case ".DOCX": case ".RTF": var docLicense = new Aspose.Words.License(); docLicense.SetLicense("Aspose.Total.lic"); break; case ".XLS": case ".XLSX": case ".CSV": var xlsLicense = new Aspose.Cells.License(); xlsLicense.SetLicense("Aspose.Total.lic"); break; case ".PPT": case ".PPTX": var pptLicense = new Aspose.Slides.License(); pptLicense.SetLicense("Aspose.Total.lic"); break; case ".VSD": case ".VSDX": var vsdLicense = new Aspose.Diagram.License(); vsdLicense.SetLicense("Aspose.Total.lic"); break; case ".MSG": var emaiLicense = new Aspose.Email.License(); var msgPdfLicense = new Aspose.Words.License(); emaiLicense.SetLicense("Aspose.Total.lic"); msgPdfLicense.SetLicense("Aspose.Total.lic"); break; default: var license = new Aspose.Words.License(); license.SetLicense("Aspose.Total.lic"); break; } }
private void PrintDocument() { Aspose.Words.License license = new Aspose.Words.License(); license.SetLicense("Aspose.Words.lic"); //Open template string docPath = Context.Server.MapPath("~/DesktopModules/TrainingCoreBanking/BankProject/Report/Template/MainAccount/OpenAccount.docx"); //Open the template document Aspose.Words.Document document = new Aspose.Words.Document(docPath); //Execute the mail merge. var ds = BankProject.DataProvider.Database.BOPENACCOUNT_Print_GetByCode(txtId.Text); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { ds.Tables[0].Rows[0]["ChiNhanh"] = ConfigurationManager.AppSettings["ChiNhanh"]; ds.Tables[0].Rows[0]["BranchAddress"] = ConfigurationManager.AppSettings["BranchAddress"]; ds.Tables[0].Rows[0]["BranchTel"] = ConfigurationManager.AppSettings["BranchTel"]; } document.MailMerge.ExecuteWithRegions(ds.Tables[0]); //moas mat thoi jan voi cuc gach nay woa // Send the document in Word format to the client browser with an option to save to disk or open inside the current browser. document.Save("OpenAccount_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".doc", Aspose.Words.SaveFormat.Doc, Aspose.Words.SaveType.OpenInBrowser, Response); }
protected void Print_Deal_Slip() { Aspose.Words.License license = new Aspose.Words.License(); license.SetLicense("Aspose.Words.lic"); //Open template string docPath = Context.Server.MapPath("~/DesktopModules/TrainingCoreBanking/BankProject/Report/Template/OutWardTransactions/cheque_withdrawl.doc"); //Open the template document Aspose.Words.Document document = new Aspose.Words.Document(docPath); //Execute the mail merge. var ds = BankProject.DataProvider.TriTT.Print_Deal_slip("Cheque", "withdrwal", tbID.Text.Trim()); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { ds.Tables[0].TableName = "Info"; document.MailMerge.ExecuteWithRegions(ds.Tables["Info"]); document.Save("Cheque_Withdrwal_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".doc", Aspose.Words.SaveFormat.Doc, Aspose.Words.SaveType.OpenInBrowser, Response); } }
protected void btnAmendNhapNgoaiBang_Click(object sender, EventArgs e) { Aspose.Words.License license = new Aspose.Words.License(); license.SetLicense("Aspose.Words.lic"); //Open template string path = Context.Server.MapPath("~/DesktopModules/TrainingCoreBanking/BankProject/Report/Template/DocumentaryCollection/Export/RegisterDocumentaryCollection_Amend_PHIEUNHAPNGOAIBANG.doc"); //Open the template document Aspose.Words.Document doc = new Aspose.Words.Document(path); //Execute the mail merge. DataSet ds = new DataSet(); ds = SQLData.P_BEXPORTDOCUMETARYCOLLECTION_AMEND_PHIEUNHAPNGOAIBANG_Report(txtCode.Text, UserInfo.Username); // Fill the fields in the document with user data. doc.MailMerge.ExecuteWithRegions(ds); //moas mat thoi jan voi cuc gach nay woa // Send the document in Word format to the client browser with an option to save to disk or open inside the current browser. doc.Save("AmendDocumentaryCollectionPHIEUNHAPNGOAIBANG_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".doc", Aspose.Words.SaveFormat.Doc, Aspose.Words.SaveType.OpenInBrowser, Response); }
private void PrintLoanDocument() { Aspose.Words.License license = new Aspose.Words.License(); license.SetLicense("Aspose.Words.lic"); //Open template //string docPath = Context.Server.MapPath("~/DesktopModules/TrainingCoreBanking/BankProject/Report/Template/LoanContract/LichTraLai.docx"); string docPath = Context.Server.MapPath("~/DesktopModules/TrainingCoreBanking/BankProject/Report/Template/LoanContract/LichTraNoHopDongVay.docx"); //Open the template document Aspose.Words.Document document = new Aspose.Words.Document(docPath); //Execute the mail merge. var ds = PrepareDataForLoanContractSchedule(); // Fill the fields in the document with user data. document.MailMerge.ExecuteWithRegions(ds.DtInfor); document.MailMerge.ExecuteWithRegions(ds.DtItems.DefaultView); document.MailMerge.ExecuteWithRegions(ds.DateReport); // Send the document in Word format to the client browser with an option to save to disk or open inside the current browser. document.Save("LichTraNoHDTinDung_" + tbNewNormalLoan.Text + "_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".pdf", Aspose.Words.SaveFormat.Pdf, Aspose.Words.SaveType.OpenInApplication, Response); //doc.Save("RegisterDocumentaryCollectionMT410_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".pdf", Aspose.Words.SaveFormat.Pdf, Aspose.Words.SaveType.OpenInApplication, Response); }
protected void Print_Deal_Slip() { Aspose.Words.License license = new Aspose.Words.License(); license.SetLicense("Aspose.Words.lic"); //Open template if (rcbProductID.SelectedValue == "1000") { string docPath = Context.Server.MapPath("~/DesktopModules/TrainingCoreBanking/BankProject/Report/Template/OutWardTransactions/transfer_by_cash_dien_CMND.doc"); //Open the template document Aspose.Words.Document document = new Aspose.Words.Document(docPath); //Execute the mail merge. var ds = BankProject.DataProvider.TriTT.Print_Deal_slip("Trans_By_Cash", "CMND", txtId.Text.Trim()); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { ds.Tables[0].TableName = "Info"; document.MailMerge.ExecuteWithRegions(ds.Tables["Info"]); document.Save("TransferByCash_CMND_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".doc", Aspose.Words.SaveFormat.Doc, Aspose.Words.SaveType.OpenInBrowser, Response); } } else { string docPath = Context.Server.MapPath("~/DesktopModules/TrainingCoreBanking/BankProject/Report/Template/OutWardTransactions/transfer_by_cash_dien_CITAD.doc"); //Open the template document Aspose.Words.Document document = new Aspose.Words.Document(docPath); //Execute the mail merge. var ds = BankProject.DataProvider.TriTT.Print_Deal_slip("Trans_By_Cash", "CITAD", txtId.Text.Trim()); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { ds.Tables[0].TableName = "Info"; document.MailMerge.ExecuteWithRegions(ds.Tables["Info"]); document.Save("TransferByCash_CITAD_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".doc", Aspose.Words.SaveFormat.Doc, Aspose.Words.SaveType.OpenInBrowser, Response); } } }
protected void Print_Deal_Slip() { Aspose.Words.License license = new Aspose.Words.License(); license.SetLicense("Aspose.Words.lic"); //Open template string docPath = Context.Server.MapPath("~/DesktopModules/TrainingCoreBanking/BankProject/Report/Template/CollectCharge/credit_card_payment_cash.doc"); //Open the template document Aspose.Words.Document document = new Aspose.Words.Document(docPath); //Execute the mail merge. var ds = TriTT.Print_Credit_CardPayment_Cash(txtId.Text); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { ds.Tables[0].TableName = "Info"; document.MailMerge.ExecuteWithRegions(ds.Tables["Info"]); document.Save("Credit_Card_Payment_Cash" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".doc", Aspose.Words.SaveFormat.Doc, Aspose.Words.SaveType.OpenInBrowser, Response); } }
protected void Print_Deal_Slip() { Aspose.Words.License license = new Aspose.Words.License(); license.SetLicense("Aspose.Words.lic"); DataSet ds; if (rcbProductID.SelectedValue == "1000") { //Open template string docPath = Context.Server.MapPath("~/DesktopModules/TrainingCoreBanking/BankProject/Report/Template/OutWardTransactions/transfer_by_account_dien_CMND.doc"); //Open the template document Aspose.Words.Document document = new Aspose.Words.Document(docPath); //Execute the mail merge. ds = BankProject.DataProvider.TriTT.Print_Deal_slip("Trans_By_Acct", "CMND", tbID.Text.Trim()); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { ds.Tables[0].TableName = "Info"; document.MailMerge.ExecuteWithRegions(ds.Tables["Info"]); document.Save("TransferByAccount_CMND_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".doc", Aspose.Words.SaveFormat.Doc, Aspose.Words.SaveType.OpenInBrowser, Response); } } else { //Open template string docPath = Context.Server.MapPath("~/DesktopModules/TrainingCoreBanking/BankProject/Report/Template/OutWardTransactions/transfer_by_account_dien_CITAD.doc"); //Open the template document Aspose.Words.Document document = new Aspose.Words.Document(docPath); //Execute the mail merge. ds = BankProject.DataProvider.TriTT.Print_Deal_slip("Trans_By_Acct", "CITAD", tbID.Text.Trim()); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { //ds.Tables[0].Rows[0]["ChiNhanh"] = ConfigurationManager.AppSettings["ChiNhanh"]; //ds.Tables[0].Rows[0]["BranchAddress"] = ConfigurationManager.AppSettings["BranchAddress"]; //ds.Tables[0].Rows[0]["BranchTel"] = ConfigurationManager.AppSettings["BranchTel"]; ds.Tables[0].TableName = "Info"; //ds.Tables[1].TableName = "Detail"; //document.MailMerge.ExecuteWithRegions(ds.Tables["Info"]); document.MailMerge.ExecuteWithRegions(ds.Tables["Info"]); // Send the document in Word format to the client browser with an option to save to disk or open inside the current browser. document.Save("TransferByAccount_CITAD_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".doc", Aspose.Words.SaveFormat.Doc, Aspose.Words.SaveType.OpenInBrowser, Response); } } }
private void PrintVat() { Aspose.Words.License license = new Aspose.Words.License(); license.SetLicense("Aspose.Words.lic"); //Open template string docPath = Context.Server.MapPath("~/DesktopModules/TrainingCoreBanking/BankProject/Report/Template/CollectCharge/CollectChargeVAT.doc"); //Open the template document Aspose.Words.Document document = new Aspose.Words.Document(docPath); //Execute the mail merge. var ds = BankProject.DataProvider.Database.BCOLLECTCHARGESFROMACCOUNT_Print_GetByCode(tbDepositCode.Text); if (ds.Tables != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { ds.Tables[0].TableName = "Table"; document.MailMerge.ExecuteWithRegions(ds.Tables["Table"]); //moas mat thoi jan voi cuc gach nay woa // Send the document in Word format to the client browser with an option to save to disk or open inside the current browser. document.Save("BCOLLECTCHARGESFROMACCOUNT_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".doc", Aspose.Words.SaveFormat.Doc, Aspose.Words.SaveType.OpenInBrowser, Response); } }
static void Main(string[] args) { // Check for license and apply if exists string licenseFile = AppDomain.CurrentDomain.BaseDirectory + "Aspose.Words.lic"; if (File.Exists(licenseFile)) { // Apply Aspose.Words API License Aspose.Words.License license = new Aspose.Words.License(); // Place license file in Bin/Debug/ Folder license.SetLicense("Aspose.Words.lic"); } Document doc = new Document(); DocumentBuilder builder = new DocumentBuilder(doc); builder.ParagraphFormat.Alignment = ParagraphAlignment.Center; builder.ParagraphFormat.Borders.LineStyle = LineStyle.Double; builder.ParagraphFormat.Borders.Bottom.LineStyle = LineStyle.Single; builder.Font.Bold = true; builder.Font.Name = "Courier"; builder.Font.Underline = Underline.DotDotDash; builder.Font.Position = 100; builder.Writeln("The quick brown fox"); builder.ParagraphFormat.ClearFormatting(); builder.ParagraphFormat.Borders.LineStyle = LineStyle.Double; builder.ParagraphFormat.Borders.Top.LineStyle = LineStyle.None; builder.ParagraphFormat.Alignment = ParagraphAlignment.Right; builder.Font.ClearFormatting(); builder.Font.StrikeThrough = true; builder.Font.Size = 20; builder.Write("jumped over the lazy dog"); builder.Font.StrikeThrough = true; builder.Font.Size = 20; builder.Font.Superscript = true; builder.Font.Color = System.Drawing.ColorTranslator.FromHtml("#FF0000"); builder.Writeln("and went away"); builder.ParagraphFormat.ClearFormatting(); builder.InsertBreak(BreakType.PageBreak); builder.Font.ClearFormatting(); builder.ParagraphFormat.Alignment = ParagraphAlignment.Justify; builder.ParagraphFormat.LineSpacingRule = LineSpacingRule.Exactly; builder.ParagraphFormat.FirstLineIndent = 600; builder.Font.Position = 20; builder.Writeln("To be, or not to be: that is the question: " + "Whether 'tis nobler in the mind to suffer " + "The slings and arrows of outrageous fortune, " + "Or to take arms against a sea of troubles, " + "And by opposing end them? To die: to sleep; "); builder.ParagraphFormat.ClearFormatting(); builder.Font.ClearFormatting(); builder.Font.Italic = true; builder.Writeln("No more; and by a sleep to say we end " + "The heart-ache and the thousand natural shocks " + "That flesh is heir to, 'tis a consummation " + "Devoutly to be wish'd. To die, to sleep; " + "To sleep: perchance to dream: ay, there's the rub; " + "......."); builder.ParagraphFormat.ClearFormatting(); builder.Font.ClearFormatting(); builder.Font.Position = 10; builder.Writeln("For in that sleep of death what dreams may come"); builder.InsertBreak(BreakType.LineBreak); builder.Writeln("When we have shuffled off this mortal coil," + "Must give us pause: there's the respect" + "That makes calamity of so long life;"); builder.InsertBreak(BreakType.LineBreak); builder.Writeln("For who would bear the whips and scorns of time," + "The oppressor's wrong, the proud man's contumely,"); builder.InsertBreak(BreakType.LineBreak); builder.Font.ClearFormatting(); builder.Writeln("The pangs of despised love, the law's delay," + "The insolence of office and the spurns" + "......."); doc.Save("ParagraphFormattingAspose.docx"); }
public DocumentEngine(){ var license = new Aspose.Words.License(); license.SetLicense("Licenses/Aspose.Words.lic"); }
bool AsposeOpen(string file) { var tmp = CopyFile(file); try { var lic = new Aspose.Words.License(); lic.SetLicense("Workshare.Policy.Actions.Tests.Aspose.Total.lic"); Aspose.Words.Document document = new Aspose.Words.Document(tmp); return true; } finally { File.Delete(tmp); } }
internal static void RemoveLicense() { Aspose.Words.License license = new Aspose.Words.License(); license.SetLicense(""); }
private void PrintDocument() { Aspose.Words.License license = new Aspose.Words.License(); license.SetLicense("Aspose.Words.lic"); //Open template string docPath = Context.Server.MapPath("~/DesktopModules/TrainingCoreBanking/BankProject/Report/Template/AccountTransaction/CashDeposit.docx"); //Open the template document Aspose.Words.Document document = new Aspose.Words.Document(docPath); //Execute the mail merge. var ds = BankProject.DataProvider.Database.BCASHDEPOSIT_Print_GetByCode(txtId.Text); document.MailMerge.ExecuteWithRegions(ds.Tables[0]); //moas mat thoi jan voi cuc gach nay woa // Send the document in Word format to the client browser with an option to save to disk or open inside the current browser. document.Save("CashDeposit_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".doc", Aspose.Words.SaveFormat.Doc, Aspose.Words.SaveType.OpenInBrowser, Response); }
private void PrintVat() { Aspose.Words.License license = new Aspose.Words.License(); license.SetLicense("Aspose.Words.lic"); //Open template string docPath = Context.Server.MapPath("~/DesktopModules/TrainingCoreBanking/BankProject/Report/Template/CollectCharge/CollectChargeVAT.doc"); //Open the template document Aspose.Words.Document document = new Aspose.Words.Document(docPath); //Execute the mail merge. var ds = BankProject.DataProvider.Database.BCOLLECTCHARGESBYCASH_Print_GetByCode(txtId.Text); document.MailMerge.ExecuteWithRegions(ds.Tables[0]); // Send the document in Word format to the client browser with an option to save to disk or open inside the current browser. document.Save("BCOLLECTCHARGESBYCASH_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".doc", Aspose.Words.SaveFormat.Doc, Aspose.Words.SaveType.OpenInBrowser, Response); }