Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

EquationSample.cs 2.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /***************************************************************************************
  2. DocX – DocX is the community edition of Xceed Words for .NET
  3. Copyright (C) 2009-2017 Xceed Software Inc.
  4. This program is provided to you under the terms of the Microsoft Public
  5. License (Ms-PL) as published at http://wpftoolkit.codeplex.com/license
  6. For more features and fast professional support,
  7. pick up Xceed Words for .NET at https://xceed.com/xceed-words-for-net/
  8. *************************************************************************************/
  9. using System;
  10. using System.Drawing;
  11. using System.IO;
  12. namespace Xceed.Words.NET.Examples
  13. {
  14. public class EquationSample
  15. {
  16. #region Private Members
  17. private const string EquationSampleOutputDirectory = Program.SampleDirectory + @"Equation\Output\";
  18. #endregion
  19. #region Constructors
  20. static EquationSample()
  21. {
  22. if( !Directory.Exists( EquationSample.EquationSampleOutputDirectory ) )
  23. {
  24. Directory.CreateDirectory( EquationSample.EquationSampleOutputDirectory );
  25. }
  26. }
  27. #endregion
  28. #region Public Methods
  29. /// <summary>
  30. /// Create a document and add Equations in it.
  31. /// </summary>
  32. public static void InsertEquation()
  33. {
  34. Console.WriteLine( "\tEquationSample()" );
  35. // Create a document.
  36. using( DocX document = DocX.Create( EquationSample.EquationSampleOutputDirectory + @"EquationSample.docx" ) )
  37. {
  38. // Add a title
  39. document.InsertParagraph( "Inserting Equations" ).FontSize( 15d ).SpacingAfter( 50d ).Alignment = Alignment.center;
  40. document.InsertParagraph( "A Linear equation : " );
  41. // Insert first Equation in this document.
  42. document.InsertEquation( "y = mx + b" ).SpacingAfter( 30d );
  43. document.InsertParagraph( "A Quadratic equation : " );
  44. // Insert second Equation in this document and add formatting.
  45. document.InsertEquation( "x = ( -b \u00B1 \u221A(b\u00B2 - 4ac))/2a" ).FontSize( 18 ).Color( Color.Blue );
  46. document.Save();
  47. Console.WriteLine( "\tCreated: EquationSample.docx\n" );
  48. }
  49. }
  50. #endregion
  51. }
  52. }