This commit is contained in:
buildautomation 2024-03-19 04:44:44 +00:00
Родитель 7e35a463f2
Коммит 2a387d3ab5
808 изменённых файлов: 0 добавлений и 297287 удалений

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -1,118 +0,0 @@
#region Copyright Syncfusion Inc. 2001-2024.
// Copyright Syncfusion Inc. 2001-2024. All rights reserved.
// Use of this code is subject to the terms of our license.
// A copy of the current license can be obtained at any time by e-mailing
// licensing@syncfusion.com. Any infringement will be prosecuted under
// applicable laws.
#endregion
using Common;
using Syncfusion.Licensing;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.ApplicationModel;
using Windows.ApplicationModel.Activation;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
namespace Syncfusion.SampleBrowser.UWP.DocIO
{
/// <summary>
/// Provides application-specific behavior to supplement the default Application class.
/// </summary>
sealed partial class App : Application
{
/// <summary>
/// Initializes the singleton application object. This is the first line of authored code
/// executed, and as such is the logical equivalent of main() or WinMain().
/// </summary>
public App()
{
SyncfusionLicenseProvider.RegisterLicense(Common.DemoCommon.FindLicenseKey("Syncfusion.SampleBrowser.UWP.DocIO.SyncfusionLicense.txt"));
this.InitializeComponent();
this.Suspending += OnSuspending;
}
/// <summary>
/// Invoked when the application is launched normally by the end user. Other entry points
/// will be used such as when the application is launched to open a specific file.
/// </summary>
/// <param name="e">Details about the launch request and process.</param>
protected override void OnLaunched(LaunchActivatedEventArgs e)
{
#if DEBUG
if (System.Diagnostics.Debugger.IsAttached)
{
this.DebugSettings.EnableFrameRateCounter = true;
}
#endif
Frame rootFrame = Window.Current.Content as Frame;
// Do not repeat app initialization when the Window already has content,
// just ensure that the window is active
if (rootFrame == null)
{
// Create a Frame to act as the navigation context and navigate to the first page
rootFrame = new Frame();
rootFrame.NavigationFailed += OnNavigationFailed;
if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
{
//TODO: Load state from previously suspended application
}
// Place the frame in the current Window
Window.Current.Content = rootFrame;
}
if (e.PrelaunchActivated == false)
{
new SamplesConfiguration();
if (rootFrame.Content == null)
{
// When the navigation stack isn't restored navigate to the first page,
// configuring the new page by passing required information as a navigation
// parameter
rootFrame.Navigate(typeof(MainPage), e.Arguments);
}
// Ensure the current window is active
Window.Current.Activate();
}
}
/// <summary>
/// Invoked when Navigation to a certain page fails
/// </summary>
/// <param name="sender">The Frame which failed navigation</param>
/// <param name="e">Details about the navigation failure</param>
void OnNavigationFailed(object sender, NavigationFailedEventArgs e)
{
throw new Exception("Failed to load Page " + e.SourcePageType.FullName);
}
/// <summary>
/// Invoked when application execution is being suspended. Application state is saved
/// without knowing whether the application will be terminated or resumed with the contents
/// of memory still intact.
/// </summary>
/// <param name="sender">The source of the suspend request.</param>
/// <param name="e">Details about the suspend request.</param>
private void OnSuspending(object sender, SuspendingEventArgs e)
{
var deferral = e.SuspendingOperation.GetDeferral();
//TODO: Save application state and stop any background activity
deferral.Complete();
}
}
}

Просмотреть файл

@ -1,3 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<ApplicationInsights xmlns = "http://schemas.microsoft.com/ApplicationInsights/2013/Settings">
</ApplicationInsights>

Двоичные данные
DocIO/Assets/Export.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 1.7 KiB

Двоичные данные
DocIO/Assets/LockScreenLogo.scale-200.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 1.4 KiB

Двоичные данные
DocIO/Assets/SplashScreen.scale-200.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 7.5 KiB

Двоичные данные
DocIO/Assets/Square150x150Logo.scale-200.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 2.9 KiB

Двоичные данные
DocIO/Assets/Square44x44Logo.scale-200.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 1.6 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 1.2 KiB

Двоичные данные
DocIO/Assets/StoreLogo.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 1.4 KiB

Двоичные данные
DocIO/Assets/Wide310x150Logo.scale-200.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 3.1 KiB

Просмотреть файл

@ -1,11 +0,0 @@
Syncfusion.SampleBrowser.UWP.Common.dll
Syncfusion.Licensing.dll
Syncfusion.SfAccordion.UWP.dll
Syncfusion.SfInput.UWP.dll
Syncfusion.SfShared.UWP.dll
Syncfusion.SfTabControl.UWP.dll
Syncfusion.DocIO.UWP.dll
Syncfusion.OfficeChart.UWP.dll
Syncfusion.Pdf.UWP.dll
Syncfusion.XlsIO.UWP.dll
Syncfusion.Licensing.dll

Двоичные данные
DocIO/DocIO/Assets/AdventureCycle.jpg

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 79 KiB

Двоичные данные
DocIO/DocIO/Assets/Apple.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 7.7 KiB

Двоичный файл не отображается.

Двоичные данные
DocIO/DocIO/Assets/Bookmark_Template.docx

Двоичный файл не отображается.

Двоичные данные
DocIO/DocIO/Assets/ContentControlTemplate.docx

Двоичный файл не отображается.

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -1,258 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<EmployeesList>
<Employees>
<FirstName>Nancy</FirstName>
<LastName>Davolio</LastName>
<EmployeeID>1</EmployeeID>
<Extension>5467</Extension>
<Address>507 - 20th Ave. E. Apt. 2A</Address>
<City>Seattle</City>
<Country>USA</Country>
<Customers>
<CustomerID>ALFKI</CustomerID>
<EmployeeID>1</EmployeeID>
<CompanyName>Alfreds Futterkiste</CompanyName>
<ContactName>Maria Anders</ContactName>
<City>Berlin</City>
<Country>Germany</Country>
<Orders>
<OrderID>10835</OrderID>
<CustomerID>ALFKI</CustomerID>
<OrderDate>1/15/1998</OrderDate>
<ShippedDate>1/21/1998</ShippedDate>
<RequiredDate>2/12/1998</RequiredDate>
</Orders>
<Orders>
<OrderID>10952</OrderID>
<CustomerID>ALFKI</CustomerID>
<OrderDate>3/16/1998</OrderDate>
<ShippedDate>3/24/1998</ShippedDate>
<RequiredDate>4/27/1998</RequiredDate>
</Orders>
</Customers>
<Customers>
<CustomerID>ANTON</CustomerID>
<EmployeeID>1</EmployeeID>
<CompanyName>Antonio Moreno Taquería</CompanyName>
<ContactName>Antonio Moreno</ContactName>
<City>México D.F.</City>
<Country>Mexico</Country>
<Orders>
<OrderID>10677</OrderID>
<CustomerID>ANTON</CustomerID>
<OrderDate>9/22/1997</OrderDate>
<ShippedDate>9/26/1997</ShippedDate>
<RequiredDate>10/20/1997</RequiredDate>
</Orders>
</Customers>
<Customers>
<CustomerID>AROUT</CustomerID>
<EmployeeID>1</EmployeeID>
<CompanyName>Around the Horn</CompanyName>
<ContactName>Thomas Hardy</ContactName>
<City>London</City>
<Country>UK</Country>
<Orders>
<OrderID>10453</OrderID>
<CustomerID>AROUT</CustomerID>
<OrderDate>2/21/1997</OrderDate>
<ShippedDate>2/26/1997</ShippedDate>
<RequiredDate>3/21/1997</RequiredDate>
</Orders>
<Orders>
<OrderID>10558</OrderID>
<CustomerID>AROUT</CustomerID>
<OrderDate>6/4/1997</OrderDate>
<ShippedDate>6/10/1997</ShippedDate>
<RequiredDate>7/2/1997</RequiredDate>
</Orders>
<Orders>
<OrderID>10743</OrderID>
<CustomerID>AROUT</CustomerID>
<OrderDate>11/17/1997</OrderDate>
<ShippedDate>11/21/1997</ShippedDate>
<RequiredDate>12/15/1997</RequiredDate>
</Orders>
</Customers>
<Customers>
<CustomerID>BOTTM</CustomerID>
<EmployeeID>1</EmployeeID>
<CompanyName>Bottom-Dollar Markets</CompanyName>
<ContactName>Elizabeth Lincoln</ContactName>
<City>Tsawassen</City>
<Country>Canada</Country>
<Orders>
<OrderID>10975</OrderID>
<CustomerID>BOTTM</CustomerID>
<OrderDate>3/25/1998</OrderDate>
<ShippedDate>3/27/1998</ShippedDate>
<RequiredDate>4/22/1998</RequiredDate>
</Orders>
<Orders>
<OrderID>11027</OrderID>
<CustomerID>BOTTM</CustomerID>
<OrderDate>4/16/1998</OrderDate>
<ShippedDate>4/20/1998</ShippedDate>
<RequiredDate>5/14/1998</RequiredDate>
</Orders>
</Customers>
</Employees>
<Employees>
<FirstName>Andrew</FirstName>
<LastName>Fuller</LastName>
<EmployeeID>2</EmployeeID>
<Extension>3457</Extension>
<Address>908 W. Capital Way</Address>
<City>Tacoma</City>
<Country>USA</Country>
<Customers>
<CustomerID>BERGS</CustomerID>
<EmployeeID>2</EmployeeID>
<CompanyName>Berglunds snabbköp</CompanyName>
<ContactName>Christina Berglund</ContactName>
<City>Luleå</City>
<Country>Sweden</Country>
<Orders>
<OrderID>10280</OrderID>
<CustomerID>BERGS</CustomerID>
<OrderDate>8/14/1996</OrderDate>
<ShippedDate>9/12/1996</ShippedDate>
<RequiredDate>9/11/1996</RequiredDate>
</Orders>
</Customers>
<Customers>
<CustomerID>BONAP</CustomerID>
<EmployeeID>2</EmployeeID>
<CompanyName>Bon app'</CompanyName>
<ContactName>Laurence Lebihan</ContactName>
<City>Marseille</City>
<Country>France</Country>
<Orders>
<OrderID>10663</OrderID>
<CustomerID>BONAP</CustomerID>
<OrderDate>9/10/1997</OrderDate>
<ShippedDate>10/3/1997</ShippedDate>
<RequiredDate>9/24/1997</RequiredDate>
</Orders>
</Customers>
<Customers>
<CustomerID>ERNSH</CustomerID>
<EmployeeID>2</EmployeeID>
<CompanyName>Ernst Handel</CompanyName>
<ContactName>Roland Mendel</ContactName>
<City>Graz</City>
<Country>Austria</Country>
<Orders>
<OrderID>10368</OrderID>
<CustomerID>ERNSH</CustomerID>
<OrderDate>11/29/1996</OrderDate>
<ShippedDate>12/2/1996</ShippedDate>
<RequiredDate>12/27/1996</RequiredDate>
</Orders>
<Orders>
<OrderID>10595</OrderID>
<CustomerID>ERNSH</CustomerID>
<OrderDate>7/10/1997</OrderDate>
<ShippedDate>7/14/1997</ShippedDate>
<RequiredDate>8/7/1997</RequiredDate>
</Orders>
<Orders>
<OrderID>10990</OrderID>
<CustomerID>ERNSH</CustomerID>
<OrderDate>4/1/1998</OrderDate>
<ShippedDate>4/7/1998</ShippedDate>
<RequiredDate>5/13/1998</RequiredDate>
</Orders>
</Customers>
</Employees>
<Employees>
<FirstName>Margaret</FirstName>
<LastName>Peacock</LastName>
<EmployeeID>3</EmployeeID>
<Extension>5176</Extension>
<Address>4110 Old Redmond Rd.</Address>
<City>Redmond</City>
<Country>USA</Country>
<Customers>
<CustomerID>ANATR</CustomerID>
<EmployeeID>3</EmployeeID>
<CompanyName>Ana Trujillo Emparedados y helados</CompanyName>
<ContactName>Ana Trujillo</ContactName>
<City>México D.F.</City>
<Country>Mexico</Country>
<Orders>
<OrderID>10926</OrderID>
<CustomerID>ANATR</CustomerID>
<OrderDate>3/4/1998</OrderDate>
<ShippedDate>3/11/1998</ShippedDate>
<RequiredDate>4/1/1998</RequiredDate>
</Orders>
</Customers>
<Customers>
<CustomerID>BLONP</CustomerID>
<EmployeeID>3</EmployeeID>
<CompanyName>Blondel père et fils</CompanyName>
<ContactName>Frédérique Citeaux</ContactName>
<City>Strasbourg</City>
<Country>France</Country>
<Orders>
<OrderID>10360</OrderID>
<CustomerID>BLONP</CustomerID>
<OrderDate>11/22/1996</OrderDate>
<ShippedDate>12/2/1996</ShippedDate>
<RequiredDate>12/20/1996</RequiredDate>
</Orders>
<Orders>
<OrderID>10584</OrderID>
<CustomerID>BLONP</CustomerID>
<OrderDate>6/30/1997</OrderDate>
<ShippedDate>7/4/1997</ShippedDate>
<RequiredDate>7/28/1997</RequiredDate>
</Orders>
<Orders>
<OrderID>10628</OrderID>
<CustomerID>BLONP</CustomerID>
<OrderDate>8/12/1997</OrderDate>
<ShippedDate>8/20/1997</ShippedDate>
<RequiredDate>9/9/1997</RequiredDate>
</Orders>
</Customers>
<Customers>
<CustomerID>COMMI</CustomerID>
<EmployeeID>3</EmployeeID>
<CompanyName>Comércio Mineiro</CompanyName>
<ContactName>Pedro Afonso</ContactName>
<City>São Paulo</City>
<Country>Brazil</Country>
<Orders>
<OrderID>10558</OrderID>
<CustomerID>COMMI</CustomerID>
<OrderDate>6/4/1997</OrderDate>
<ShippedDate>6/10/1997</ShippedDate>
<RequiredDate>7/2/1997</RequiredDate>
</Orders>
<Orders>
<OrderID>10542</OrderID>
<CustomerID>COMMI</CustomerID>
<OrderDate>5/1/1997</OrderDate>
<ShippedDate>5/7/1997</ShippedDate>
<RequiredDate>5/29/1997</RequiredDate>
</Orders>
</Customers>
<Customers>
<CustomerID>DRACD</CustomerID>
<EmployeeID>3</EmployeeID>
<CompanyName>Drachenblut Delikatessen</CompanyName>
<ContactName>Sven Ottlieb</ContactName>
<City>Aachen</City>
<Country>Germany</Country>
<Orders>
<OrderID>10955</OrderID>
<CustomerID>DRACD</CustomerID>
<OrderDate>3/16/1998</OrderDate>
<ShippedDate>3/24/1998</ShippedDate>
<RequiredDate>4/27/1998</RequiredDate>
</Orders>
</Customers>
</Employees>
</EmployeesList>

Двоичные данные
DocIO/DocIO/Assets/Excel_Template.xlsx

Двоичный файл не отображается.

Двоичные данные
DocIO/DocIO/Assets/Grape.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 6.4 KiB

Двоичные данные
DocIO/DocIO/Assets/Image.gif

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 19 KiB

Двоичные данные
DocIO/DocIO/Assets/Letter Formatting.doc

Двоичный файл не отображается.

Двоичные данные
DocIO/DocIO/Assets/Letter Formatting.docx

Двоичный файл не отображается.

Двоичные данные
DocIO/DocIO/Assets/Letter Formatting_WP.docx

Двоичный файл не отображается.

Просмотреть файл

@ -1,70 +0,0 @@
# A tour of the C\# language
C\# (pronounced "See Sharp") is a modern, object\-oriented, and type\-safe programming language. C\# enables developers to build many types of secure and robust applications that run in .NET. C\# has its roots in the C family of languages and will be immediately familiar to C, C\+\+, Java, and JavaScript programmers. This tour provides an overview of the major components of the language in C\# 11 and earlier. If you want to explore the language through interactive examples, try the [introduction to C#](https://learn.microsoft.com/en-us/dotnet/csharp/tour-of-csharp/tutorials/) tutorials.
Several C\# features help create robust and durable applications. [Garbage collection](https://learn.microsoft.com/en-us/dotnet/standard/garbage-collection/) automatically reclaims memory occupied by unreachable unused objects. [Nullable types](https://learn.microsoft.com/en-us/dotnet/csharp/nullable-references) guard against variables that don't refer to allocated objects. [Exception handling](https://learn.microsoft.com/en-us/dotnet/csharp/fundamentals/exceptions/) provides a structured and extensible approach to error detection and recovery. [Lambda expressions](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/operators/lambda-expressions) support functional programming techniques. [Language Integrated Query (LINQ)](https://learn.microsoft.com/en-us/dotnet/csharp/linq/) syntax creates a common pattern for working with data from any source. Language support for [asynchronous operations](https://learn.microsoft.com/en-us/dotnet/csharp/programming-guide/concepts/async/) provides syntax for building distributed systems. C\# has a [unified type system](https://learn.microsoft.com/en-us/dotnet/csharp/fundamentals/types/). All C\# types, including primitive types such as `int` and `double`, inherit from a single root `object` type. All types share a set of common operations. Values of any type can be stored, transported, and operated upon in a consistent manner. Furthermore, C\# supports both user\-defined [reference types](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/reference-types) and [value types](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/value-types). C\# allows dynamic allocation of objects and in\-line storage of lightweight structures. C\# supports generic methods and types, which provide increased type safety and performance. C\# provides iterators, which enable implementers of collection classes to define custom behaviors for client code.
# Hello world
The "Hello, World" program is traditionally used to introduce a programming language. Here it is in C\#:
```
using System;
class Hello
{
static void Main()
{
Console.WriteLine("Hello, World");
}
}
```
The "Hello, World" program starts with a `using` directive that references the `System` namespace. Namespaces provide a hierarchical means of organizing C\# programs and libraries. A `using` directive that references a given namespace enables unqualified use of the types that are members of that namespace. Because of the `using` directive, the program can use Console.WriteLine as shorthand for System.Console.WriteLine.
The Hello `class` declared by the "Hello, World" program has a single member, the method named `Main`. The `Main` method is declared with the static modifier. By convention, a static method named `Main` serves as the entry point of a C\# program.
The output of the program is produced by the `WriteLine` method of the `Console` class in the `System` namespace. This class is provided by the standard class libraries, which, by default, are automatically referenced by the compiler.
# Types and variables
A *type* defines the structure and behavior of any data in C\#. The declaration of a type may include its members, base type, interfaces it implements, and operations permitted for that type. A *variable* is a label that refers to an instance of a specific type.
There are two kinds of types in C\#: 
1. Value types
1. Reference types.
## Value types
C\#'s value types are further divided into *simple types*, *enum types*, *struct types*, *nullable value types*, and *tuple value types*.
|Value types|Details|
|:---|:---|
|[Simple types](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/value-types)|[Signed integral](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/integral-numeric-types), [unsigned integral](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/integral-numeric-types), [unicode characters](https://learn.microsoft.com/en-us/dotnet/standard/base-types/character-encoding-introduction), [IEEE binary floating-point](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/floating-point-numeric-types), [High-precision decimal floating-point](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/floating-point-numeric-types), and boolean. |
|[Enum types](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/enum)|User\-defined types of the form `enum E {...}`. An `enum` type is a distinct type with named constants. Every `enum` type has an underlying type, which must be one of the eight integral types. The set of values of an `enum` type is the same as the set of values of the underlying type.|
|[Struct types](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/struct)|User\-defined types of the form `struct S {...}`|
|[Nullable value types](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/nullable-value-types)|Extensions of all other value types with a `null` value|
|[Tuple value types](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/value-tuples)|User\-defined types of the form  `(T1, T2, ...)`|
## Reference types
|Reference types|Details|
|:---|:---|
|[Class types](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/class) |Ultimate base class of all other types: object. Unicode strings: string, which represents a sequence of UTF\-16 code units. User\-defined types of the form class C {...}|
|[Interface types](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/interface) |User\-defined types of the form interface I {...}|
|[Array types](https://learn.microsoft.com/en-us/dotnet/csharp/programming-guide/arrays/) |Single\-dimensional, multi\-dimensional, and jagged. For example: int\[], int\[,], and int\[]\[] |
|[Delegate types](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/reference-types) |User\-defined types of the form delegate int D(...) |
C\# programs use *type declarations* to create new types. A type declaration specifies the name and the members of the new type. Six of C\#'s categories of types are user\-definable: class types, struct types, interface types, enum types, delegate types, and tuple value types. You can also declare `record` types, either `record struct`, or `record class`. Record types have compiler\-synthesized members. You use records primarily for storing values, with minimal associated behavior.
- A `class` type defines a data structure that contains data members (fields) and function members (methods, properties, and others). Class types support single inheritance and polymorphism, mechanisms whereby derived classes can extend and specialize base classes.
- A `struct` type is similar to a class type in that it represents a structure with data members and function members. However, unlike classes, structs are value types and don't typically require heap allocation. Struct types don't support user\-specified inheritance, and all struct types implicitly inherit from type `object`.
- An `interface` type defines a contract as a named set of public members. A `class` or `struct` that implements an `interface` must provide implementations of the interface's members. An `interface` may inherit from multiple base interfaces, and a `class` or `struct` may implement multiple interfaces.
- A `delegate` type represents references to methods with a particular parameter list and return type. Delegates make it possible to treat methods as entities that can be assigned to variables and passed as parameters. Delegates are analogous to function types provided by functional languages. They're also similar to the concept of function pointers found in some other languages. Unlike function pointers, delegates are object\-oriented and type\-safe.
You can explore more about C\# in this [tutorials](https://learn.microsoft.com/en-us/dotnet/csharp/fundamentals/tutorials/classes).

Двоичные данные
DocIO/DocIO/Assets/MetroStudio1.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 13 KiB

Двоичные данные
DocIO/DocIO/Assets/MetroStudio2.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 10 KiB

Двоичные данные
DocIO/DocIO/Assets/MetroStudio3.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 21 KiB

Двоичные данные
DocIO/DocIO/Assets/Mountain-200.jpg

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 20 KiB

Двоичные данные
DocIO/DocIO/Assets/Mountain-300.jpg

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 18 KiB

Двоичные данные
DocIO/DocIO/Assets/Northwind.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 87 KiB

Двоичные данные
DocIO/DocIO/Assets/Northwind_logo.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 6.9 KiB

Двоичные данные
DocIO/DocIO/Assets/OriginalDocument.docx

Двоичный файл не отображается.

Просмотреть файл

@ -1,54 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Products>
<Product>
<SNO>1</SNO>
<ProductName>Côte de Blaye</ProductName>
<Sum>141.396</Sum>
</Product>
<Product>
<SNO>2</SNO>
<ProductName>Thüringer Rostbratwurst</ProductName>
<Sum>80.368</Sum>
</Product>
<Product>
<SNO>3</SNO>
<ProductName>Raclette Courdavault</ProductName>
<Sum>71.155</Sum>
</Product>
<Product>
<SNO>4</SNO>
<ProductName>Tarte au sucre </ProductName>
<Sum>47.234</Sum>
</Product>
<Product>
<SNO>5</SNO>
<ProductName>Camembert Pierrot </ProductName>
<Sum>46.825</Sum>
</Product>
<Product>
<SNO>6</SNO>
<ProductName>Gnocchi di nonna Alice</ProductName>
<Sum>42.593</Sum>
</Product>
<Product>
<SNO>7</SNO>
<ProductName>Manjimup Dried Apples</ProductName>
<Sum>41.819</Sum>
</Product>
<Product>
<SNO>8</SNO>
<ProductName>Alice Mutton</ProductName>
<Sum>32.698</Sum>
</Product>
<Product>
<SNO>9</SNO>
<ProductName>Carnarvon Tigers</ProductName>
<Sum>29.171</Sum>
</Product>
<Product>
<SNO>10</SNO>
<ProductName>Rössle Sauerkraut.</ProductName>
<Sum>25.696</Sum>
</Product>
</Products>

Двоичные данные
DocIO/DocIO/Assets/RevisedDocument.docx

Двоичный файл не отображается.

Двоичные данные
DocIO/DocIO/Assets/Road-550-W.jpg

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 20 KiB

Двоичные данные
DocIO/DocIO/Assets/Security Settings.docx

Двоичный файл не отображается.

Двоичные данные
DocIO/DocIO/Assets/Soup.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 6.5 KiB

Двоичные данные
DocIO/DocIO/Assets/Template_Letter.doc

Двоичный файл не отображается.

Двоичные данные
DocIO/DocIO/Assets/Template_Letter_WP.doc

Двоичный файл не отображается.

Двоичные данные
DocIO/DocIO/Assets/Template_Report.doc

Двоичный файл не отображается.

Двоичные данные
DocIO/DocIO/Assets/TrackChangesTemplate.docx

Двоичный файл не отображается.

Двоичные данные
DocIO/DocIO/Assets/WinFAQ.txt

Двоичный файл не отображается.

Двоичные данные
DocIO/DocIO/Assets/Word to ODT.docx

Двоичный файл не отображается.

Двоичные данные
DocIO/DocIO/Assets/syncfusion_logo.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 2.0 KiB

Двоичные данные
DocIO/DocIO/Assets/wordtoodt.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 2.2 KiB

Просмотреть файл

@ -1,43 +0,0 @@
<View:SampleLayout
x:Class="EssentialDocIO.AutoShapesDemo"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:EssentialDocIO" xmlns:View="using:Common"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<View:SampleLayout.Sample>
<ContentControl>
<Grid x:Name="AutoShapes" Background="{StaticResource ApplicationPageBackgroundThemeBrush}" Padding="10,0,0,0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock x:Name="TextBlock1" Grid.Row="0" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="18"/>
<TextBlock x:Name="TextBlock2" Grid.Row="1" Grid.ColumnSpan="4" TextWrapping="Wrap" Text="This sample demonstrates to create Autoshapes for Word document using Essential DocIO." FontFamily="Segoe UI" FontSize="20" Foreground="#333333"/>
<TextBlock x:Name="TextBlock3" Grid.Row="2" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="18"/>
<TextBlock x:Name="TextBlock4" Grid.Row="3" Grid.ColumnSpan="4" TextWrapping="Wrap" Text="Please click the Generate button to save and view the Word document generated by Essential DocIO." FontFamily="Segoe UI" FontSize="16" Foreground="#333333"/>
<TextBlock x:Name="TextBlock5" Grid.Row="4" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="16"/>
<TextBlock x:Name="TextBlock6" Grid.Row="6" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="14"/>
<Button x:Name="Button1" Grid.Row="10" Grid.ColumnSpan="4" Content="Generate" Click="Button_Click_1" FontFamily="Segoe UI" FontSize="16" Foreground="#FFFFFF" Background="#656868" Padding="30,10,30,10"/>
<TextBlock x:Name="TextBlock7" Grid.Row="11" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="16"/>
</Grid>
</ContentControl>
</View:SampleLayout.Sample>
</View:SampleLayout>

Просмотреть файл

@ -1,242 +0,0 @@
#region Copyright Syncfusion Inc. 2001-2024.
// Copyright Syncfusion Inc. 2001-2024. All rights reserved.
// Use of this code is subject to the terms of our license.
// A copy of the current license can be obtained at any time by e-mailing
// licensing@syncfusion.com. Any infringement will be prosecuted under
// applicable laws.
#endregion
using Common;
using Syncfusion.DocIO;
using Syncfusion.DocIO.DLS;
using System;
using System.Collections.Generic;
using System.IO;
using Windows.Storage;
using Windows.Storage.Pickers;
using Windows.UI.Popups;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
namespace EssentialDocIO
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class AutoShapesDemo : SampleLayout
{
public AutoShapesDemo()
{
InitializeComponent();
if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons"))
{
TextBlock4.Visibility = Visibility.Collapsed;
}
}
public override void Dispose()
{
base.Dispose();
DisposeTextBlock(TextBlock1);
TextBlock1 = null;
DisposeTextBlock(TextBlock2);
TextBlock2 = null;
DisposeTextBlock(TextBlock3);
TextBlock3 = null;
DisposeTextBlock(TextBlock4);
TextBlock4 = null;
DisposeTextBlock(TextBlock5);
TextBlock5 = null;
DisposeTextBlock(TextBlock6);
TextBlock6 = null;
DisposeTextBlock(TextBlock7);
TextBlock7 = null;
Button1.Click -= Button_Click_1;
DisposeButton(Button1);
Button1 = null;
AutoShapes.ClearValue(Grid.BackgroundProperty);
AutoShapes.ClearValue(Grid.PaddingProperty);
AutoShapes.Children.Clear();
AutoShapes.ColumnDefinitions.Clear();
AutoShapes.RowDefinitions.Clear();
AutoShapes = null;
}
public void DisposeTextBlock(TextBlock textBlock)
{
textBlock.ClearValue(TextBlock.FontFamilyProperty);
textBlock.ClearValue(TextBlock.FontSizeProperty);
textBlock.ClearValue(TextBlock.TextProperty);
textBlock.ClearValue(TextBlock.TextWrappingProperty);
textBlock.ClearValue(TextBlock.ForegroundProperty);
}
public void DisposeButton(Button button)
{
button.ClearValue(Button.FontFamilyProperty);
button.ClearValue(Button.FontSizeProperty);
button.ClearValue(Button.PaddingProperty);
button.ClearValue(Button.ForegroundProperty);
button.ClearValue(Button.BackgroundProperty);
button.ClearValue(Button.ContentProperty);
}
private void Button_Click_1(object sender, RoutedEventArgs e)
{
//Initialize Word document
WordDocument doc = new WordDocument();
//Ensure Minimum
doc.EnsureMinimal();
//Append AutoShape
Shape shape = doc.LastParagraph.AppendShape(AutoShapeType.RoundedRectangle, 130, 45);
//Set horizontal alignment
shape.HorizontalAlignment = ShapeHorizontalAlignment.Center;
//Set horizontal origin
shape.HorizontalOrigin = HorizontalOrigin.Page;
//Set vertical origin
shape.VerticalOrigin = VerticalOrigin.Page;
//Set vertical position
shape.VerticalPosition = 50;
//Set AllowOverlap to true for overlapping shapes
shape.WrapFormat.AllowOverlap = true;
//Set Fill Color
shape.FillFormat.Color = Color.Blue;
//Set Content vertical alignment
shape.TextFrame.TextVerticalAlignment = Syncfusion.DocIO.DLS.VerticalAlignment.Middle;
//Add Texbody contents to Shape
IWParagraph para = shape.TextBody.AddParagraph();
para.ParagraphFormat.HorizontalAlignment = Syncfusion.DocIO.DLS.HorizontalAlignment.Center;
para.AppendText("Requirement").ApplyCharacterFormat(new WCharacterFormat(doc) { Bold = true, TextColor = Color.White, FontSize = 12, FontName = "Verdana" });
shape = doc.LastParagraph.AppendShape(AutoShapeType.DownArrow, 45, 45);
shape.HorizontalAlignment = ShapeHorizontalAlignment.Center;
shape.HorizontalOrigin = HorizontalOrigin.Page;
shape.VerticalOrigin = VerticalOrigin.Page;
shape.VerticalPosition = 95;
shape.WrapFormat.AllowOverlap = true;
shape = doc.LastParagraph.AppendShape(AutoShapeType.RoundedRectangle, 130, 45);
shape.HorizontalAlignment = ShapeHorizontalAlignment.Center;
shape.HorizontalOrigin = HorizontalOrigin.Page;
shape.VerticalOrigin = VerticalOrigin.Page;
shape.VerticalPosition = 140;
shape.WrapFormat.AllowOverlap = true;
shape.FillFormat.Color = Color.Orange;
shape.TextFrame.TextVerticalAlignment = Syncfusion.DocIO.DLS.VerticalAlignment.Middle;
para = shape.TextBody.AddParagraph();
para.ParagraphFormat.HorizontalAlignment = Syncfusion.DocIO.DLS.HorizontalAlignment.Center;
para.AppendText("Design").ApplyCharacterFormat(new WCharacterFormat(doc) { Bold = true, TextColor = Color.White, FontSize = 12, FontName = "Verdana" });
shape = doc.LastParagraph.AppendShape(AutoShapeType.DownArrow, 45, 45);
shape.HorizontalAlignment = ShapeHorizontalAlignment.Center;
shape.HorizontalOrigin = HorizontalOrigin.Page;
shape.VerticalOrigin = VerticalOrigin.Page;
shape.VerticalPosition = 185;
shape.WrapFormat.AllowOverlap = true;
shape = doc.LastParagraph.AppendShape(AutoShapeType.RoundedRectangle, 130, 45);
shape.HorizontalAlignment = ShapeHorizontalAlignment.Center;
shape.HorizontalOrigin = HorizontalOrigin.Page;
shape.VerticalOrigin = VerticalOrigin.Page;
shape.VerticalPosition = 230;
shape.WrapFormat.AllowOverlap = true;
shape.FillFormat.Color = Color.Blue;
shape.TextFrame.TextVerticalAlignment = Syncfusion.DocIO.DLS.VerticalAlignment.Middle;
para = shape.TextBody.AddParagraph();
para.ParagraphFormat.HorizontalAlignment = Syncfusion.DocIO.DLS.HorizontalAlignment.Center;
para.AppendText("Execution").ApplyCharacterFormat(new WCharacterFormat(doc) { Bold = true, TextColor = Color.White, FontSize = 12, FontName = "Verdana" });
shape = doc.LastParagraph.AppendShape(AutoShapeType.DownArrow, 45, 45);
shape.HorizontalAlignment = ShapeHorizontalAlignment.Center;
shape.HorizontalOrigin = HorizontalOrigin.Page;
shape.VerticalOrigin = VerticalOrigin.Page;
shape.VerticalPosition = 275;
shape.WrapFormat.AllowOverlap = true;
shape = doc.LastParagraph.AppendShape(AutoShapeType.RoundedRectangle, 130, 45);
shape.HorizontalAlignment = ShapeHorizontalAlignment.Center;
shape.HorizontalOrigin = HorizontalOrigin.Page;
shape.VerticalOrigin = VerticalOrigin.Page;
shape.VerticalPosition = 320;
shape.WrapFormat.AllowOverlap = true;
shape.FillFormat.Color = Color.Violet;
shape.TextFrame.TextVerticalAlignment = Syncfusion.DocIO.DLS.VerticalAlignment.Middle;
para = shape.TextBody.AddParagraph();
para.ParagraphFormat.HorizontalAlignment = Syncfusion.DocIO.DLS.HorizontalAlignment.Center;
para.AppendText("Testing").ApplyCharacterFormat(new WCharacterFormat(doc) { Bold = true, TextColor = Color.White, FontSize = 12, FontName = "Verdana" });
shape = doc.LastParagraph.AppendShape(AutoShapeType.DownArrow, 45, 45);
shape.HorizontalAlignment = ShapeHorizontalAlignment.Center;
shape.HorizontalOrigin = HorizontalOrigin.Page;
shape.VerticalOrigin = VerticalOrigin.Page;
shape.VerticalPosition = 365;
shape.WrapFormat.AllowOverlap = true;
shape = doc.LastParagraph.AppendShape(AutoShapeType.RoundedRectangle, 130, 45);
shape.HorizontalAlignment = ShapeHorizontalAlignment.Center;
shape.HorizontalOrigin = HorizontalOrigin.Page;
shape.VerticalOrigin = VerticalOrigin.Page;
shape.VerticalPosition = 410;
shape.WrapFormat.AllowOverlap = true;
shape.FillFormat.Color = Color.PaleVioletRed;
shape.TextFrame.TextVerticalAlignment = Syncfusion.DocIO.DLS.VerticalAlignment.Middle;
para = shape.TextBody.AddParagraph();
para.ParagraphFormat.HorizontalAlignment = Syncfusion.DocIO.DLS.HorizontalAlignment.Center;
para.AppendText("Release").ApplyCharacterFormat(new WCharacterFormat(doc) { Bold = true, TextColor = Color.White, FontSize = 12, FontName = "Verdana" });
SaveDocx(doc);
}
/// <summary>
/// Save as Docx Format
/// </summary>
/// <param name="doc"></param>
private async void SaveDocx(WordDocument doc)
{
StorageFile stgFile;
if (!(Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons")))
{
FileSavePicker savePicker = new FileSavePicker();
savePicker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary;
// Dropdown of file types the user can save the file as
savePicker.FileTypeChoices.Add("Word Document", new List<string>() { ".docx" });
// Default file name if the user does not type one in or select a file to replace
savePicker.SuggestedFileName = "Sample";
stgFile = await savePicker.PickSaveFileAsync();
}
else
{
StorageFolder local = Windows.Storage.ApplicationData.Current.LocalFolder;
stgFile = await local.CreateFileAsync("WordDocument.docx", CreationCollisionOption.ReplaceExisting);
}
if (stgFile != null)
{
MemoryStream stream = new MemoryStream();
await doc.SaveAsync(stream, FormatType.Docx);
doc.Close();
stream.Position = 0;
Windows.Storage.Streams.IRandomAccessStream fileStream = await stgFile.OpenAsync(FileAccessMode.ReadWrite);
Stream st = fileStream.AsStreamForWrite();
st.SetLength(0);
st.Write((stream as MemoryStream).ToArray(), 0, (int)stream.Length);
st.Flush();
st.Dispose();
fileStream.Dispose();
//Save as Docx Format
MessageDialog msgDialog = new MessageDialog("Do you want to view the Document?", "File has been created successfully.");
UICommand yesCmd = new UICommand("Yes");
msgDialog.Commands.Add(yesCmd);
UICommand noCmd = new UICommand("No");
msgDialog.Commands.Add(noCmd);
IUICommand cmd = await msgDialog.ShowAsync();
if (cmd == yesCmd)
{
// Launch the retrieved file
bool success = await Windows.System.Launcher.LaunchFileAsync(stgFile);
}
}
}
}
}

Просмотреть файл

@ -1,45 +0,0 @@
<View:SampleLayout
x:Class="EssentialDocIO.BarChartDemo"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:EssentialDocIO" xmlns:View="using:Common"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<View:SampleLayout.Sample>
<ContentControl>
<Grid x:Name="BarChart" Background="{StaticResource ApplicationPageBackgroundThemeBrush}" Padding="10,0,0,0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock x:Name="TextBlock1" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="18"/>
<TextBlock x:Name="TextBlock2" Grid.Row="1" Grid.ColumnSpan="4" TextWrapping="Wrap" Text="This sample illustrates inserting bar chart into a Word document with data from an existing Excel file." FontFamily="Segoe UI" FontSize="20" Foreground="#333333"/>
<TextBlock x:Name="TextBlock3" Grid.Row="2" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="18"/>
<TextBlock x:Name="TextBlock4" Grid.Row="3" Grid.ColumnSpan="4" TextWrapping="Wrap" Text="Please click the Generate button to save and view the Word document generated by Essential DocIO." FontFamily="Segoe UI" FontSize="16" Foreground="#333333"/>
<TextBlock x:Name="TextBlock5" Grid.Row="4" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="16"/>
<TextBlock x:Name="TextBlock6" Grid.Row="6" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="16"/>
<Button x:Name="Button1" Grid.Row="12" Grid.ColumnSpan="4" Content="Generate" Click="Button_Click_1" FontFamily="Segoe UI" FontSize="16" Foreground="#FFFFFF" Background="#656868" Height="Auto" Width="Auto" Padding="30,10,30,10" />
<TextBlock x:Name="TextBlock7" Grid.Row="13" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="16"/>
</Grid>
</ContentControl>
</View:SampleLayout.Sample>
</View:SampleLayout>

Просмотреть файл

@ -1,187 +0,0 @@
#region Copyright Syncfusion Inc. 2001-2024.
// Copyright Syncfusion Inc. 2001-2024. All rights reserved.
// Use of this code is subject to the terms of our license.
// A copy of the current license can be obtained at any time by e-mailing
// licensing@syncfusion.com. Any infringement will be prosecuted under
// applicable laws.
#endregion
using Common;
using Syncfusion.DocIO;
using Syncfusion.DocIO.DLS;
using Syncfusion.OfficeChart;
using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using Windows.Storage;
using Windows.Storage.Pickers;
using Windows.UI.Popups;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
namespace EssentialDocIO
{
public sealed partial class BarChartDemo : SampleLayout
{
public BarChartDemo()
{
InitializeComponent();
if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons"))
{
BarChart.Margin = new Thickness(10, 10, 10, 10);
TextBlock4.Visibility = Visibility.Collapsed;
}
}
public override void Dispose()
{
base.Dispose();
DisposeTextBlock(TextBlock1);
TextBlock1 = null;
DisposeTextBlock(TextBlock2);
TextBlock2 = null;
DisposeTextBlock(TextBlock3);
TextBlock3 = null;
DisposeTextBlock(TextBlock4);
TextBlock4 = null;
DisposeTextBlock(TextBlock5);
TextBlock5 = null;
DisposeTextBlock(TextBlock6);
TextBlock6 = null;
DisposeTextBlock(TextBlock7);
TextBlock7 = null;
Button1.Click -= Button_Click_1;
DisposeButton(Button1);
Button1 = null;
BarChart.ClearValue(Grid.BackgroundProperty);
BarChart.ClearValue(Grid.PaddingProperty);
BarChart.Children.Clear();
BarChart.ColumnDefinitions.Clear();
BarChart.RowDefinitions.Clear();
BarChart = null;
}
public void DisposeTextBlock(TextBlock textBlock)
{
textBlock.ClearValue(TextBlock.FontFamilyProperty);
textBlock.ClearValue(TextBlock.FontSizeProperty);
textBlock.ClearValue(TextBlock.TextProperty);
textBlock.ClearValue(TextBlock.TextWrappingProperty);
textBlock.ClearValue(TextBlock.ForegroundProperty);
}
public void DisposeButton(Button button)
{
button.ClearValue(Button.FontFamilyProperty);
button.ClearValue(Button.FontSizeProperty);
button.ClearValue(Button.PaddingProperty);
button.ClearValue(Button.ForegroundProperty);
button.ClearValue(Button.BackgroundProperty);
button.ClearValue(Button.ContentProperty);
button.ClearValue(Button.HeightProperty);
button.ClearValue(Button.WidthProperty);
}
private void Button_Click_1(object sender, RoutedEventArgs e)
{
Assembly execAssem = typeof(BarChartDemo).GetTypeInfo().Assembly;
//A new document is created.
WordDocument document = new WordDocument();
//Add new section to the Word document
IWSection section = document.AddSection();
//Set page margins of the section
section.PageSetup.Margins.All = 72;
//Add new paragraph to the section
IWParagraph paragraph = section.AddParagraph();
//Apply heading style to the title paragraph
paragraph.ApplyStyle(BuiltinStyle.Heading1);
//Apply center alignment to the paragraph
paragraph.ParagraphFormat.HorizontalAlignment = Syncfusion.DocIO.DLS.HorizontalAlignment.Center;
//Append text to the paragraph
paragraph.AppendText("Northwind Management Report").CharacterFormat.TextColor = Syncfusion.DocIO.DLS.Color.FromArgb(46, 116, 181);
//Add new paragraph
paragraph = section.AddParagraph();
//Set before spacing to the paragraph
paragraph.ParagraphFormat.BeforeSpacing = 20;
//Load the excel template as stream
Stream excelStream = execAssem.GetManifestResourceStream("Syncfusion.SampleBrowser.UWP.DocIO.DocIO.Assets.Excel_Template.xlsx");
//Create and Append chart to the paragraph with excel stream as parameter
WChart barChart = paragraph.AppendChart(excelStream, 1, "B2:C6", 470, 300);
//Set chart data
barChart.ChartType = OfficeChartType.Bar_Clustered;
barChart.ChartTitle = "Purchase Details";
barChart.ChartTitleArea.FontName = "Calibri (Body)";
barChart.ChartTitleArea.Size = 14;
//Set name to chart series
barChart.Series[0].Name = "Sum of Purchases";
barChart.Series[1].Name = "Sum of Future Expenses";
//Set Chart Data table
barChart.HasDataTable = true;
barChart.DataTable.HasBorders = true;
barChart.DataTable.HasHorzBorder = true;
barChart.DataTable.HasVertBorder = true;
barChart.DataTable.ShowSeriesKeys = true;
barChart.HasLegend = false;
//Setting background color
barChart.ChartArea.Fill.ForeColor = Syncfusion.Drawing.Color.FromArgb(208, 206, 206);
barChart.PlotArea.Fill.ForeColor = Syncfusion.Drawing.Color.FromArgb(208, 206, 206);
//Setting line pattern to the chart area
barChart.PrimaryCategoryAxis.Border.LinePattern = OfficeChartLinePattern.None;
barChart.PrimaryValueAxis.Border.LinePattern = OfficeChartLinePattern.None;
barChart.ChartArea.Border.LinePattern = OfficeChartLinePattern.None;
barChart.PrimaryValueAxis.MajorGridLines.Border.LineColor = Syncfusion.Drawing.Color.FromArgb(175, 171, 171);
//Set label for primary catagory axis
barChart.PrimaryCategoryAxis.CategoryLabels = barChart.ChartData[2, 1, 6, 1];
#region Saving Document
SaveDocx(document);
#endregion
}
private async void SaveDocx(WordDocument doc)
{
StorageFile stgFile;
if (!(Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons")))
{
FileSavePicker savePicker = new FileSavePicker();
savePicker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary;
// Dropdown of file types the user can save the file as
savePicker.FileTypeChoices.Add("Word Document", new List<string>() { ".docx" });
// Default file name if the user does not type one in or select a file to replace
savePicker.SuggestedFileName = "Sample";
stgFile = await savePicker.PickSaveFileAsync();
}
else
{
StorageFolder local = Windows.Storage.ApplicationData.Current.LocalFolder;
stgFile = await local.CreateFileAsync("WordDocument.docx", CreationCollisionOption.ReplaceExisting);
}
if (stgFile != null)
{
MemoryStream stream = new MemoryStream();
await doc.SaveAsync(stream, FormatType.Docx);
doc.Close();
stream.Position = 0;
Windows.Storage.Streams.IRandomAccessStream fileStream = await stgFile.OpenAsync(FileAccessMode.ReadWrite);
Stream st = fileStream.AsStreamForWrite();
st.SetLength(0);
st.Write((stream as MemoryStream).ToArray(), 0, (int)stream.Length);
st.Flush();
st.Dispose();
fileStream.Dispose();
//Save as Docx Format
MessageDialog msgDialog = new MessageDialog("Do you want to view the Document?", "File has been created successfully.");
UICommand yesCmd = new UICommand("Yes");
msgDialog.Commands.Add(yesCmd);
UICommand noCmd = new UICommand("No");
msgDialog.Commands.Add(noCmd);
IUICommand cmd = await msgDialog.ShowAsync();
if (cmd == yesCmd)
{
// Launch the retrieved file
bool success = await Windows.System.Launcher.LaunchFileAsync(stgFile);
}
}
}
}
}

Просмотреть файл

@ -1,53 +0,0 @@
<View:SampleLayout
x:Class="EssentialDocIO.BookmarkNavigationDemo"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:EssentialDocIO" xmlns:View="using:Common"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<View:SampleLayout.Sample>
<ContentControl>
<Grid x:Name="BookmarkNavigatioin" Background="{StaticResource ApplicationPageBackgroundThemeBrush}" Padding="10,0,0,0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock x:Name="TextBlock1" Grid.Row="0" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="18"/>
<TextBlock x:Name="TextBlock2" Grid.Row="1" Grid.ColumnSpan="4" TextWrapping="Wrap" Text="This sample demonstrates the bookmark navigation in Word document using Essential DocIO." FontFamily="Segoe UI" FontSize="20" Foreground="#333333"/>
<TextBlock x:Name="TextBlock3" Grid.Row="2" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="18"/>
<TextBlock x:Name="TextBlock4" Grid.Row="3" Grid.ColumnSpan="4" TextWrapping="Wrap" Text="Please click the Generate button to save and view the Word document generated by Essential DocIO." FontFamily="Segoe UI" FontSize="16" Foreground="#333333"/>
<TextBlock x:Name="TextBlock5" Grid.Row="4" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="16"/>
<TextBlock x:Name="TextBlock6" Grid.Row="5" TextWrapping="Wrap" Text="Save As" FontFamily="Segoe UI" FontSize="16" Foreground="#333333"/>
<TextBlock x:Name="TextBlock7" Grid.Row="6" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="14"/>
<StackPanel Name="stackPnlOptions" Grid.Row="9" Grid.ColumnSpan="4" Orientation="Horizontal" HorizontalAlignment="Left">
<RadioButton GroupName="Save As" Content="DOC" FontFamily="Segoe UI" FontSize="16" Foreground="#333333" x:Name="rdDoc" Width="150" />
<RadioButton GroupName="Save As" Content="DOCX" FontFamily="Segoe UI" FontSize="16" Foreground="#333333" x:Name="rdDocx" Width="150" IsChecked="True"/>
</StackPanel>
<TextBlock x:Name="TextBlock8" Grid.Row="10" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="14"/>
<TextBlock x:Name="TextBlock9" Grid.Row="11" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="14"/>
<Button x:Name="Button2" Grid.Row="12" Grid.Column="0" Grid.ColumnSpan="4" Content="View Template" Click="Button_Click_2" FontFamily="Segoe UI" FontSize="16" Foreground="#FFFFFF" Background="#656868" Height="Auto" Width="Auto" Padding="30,10,30,10"/>
<Button x:Name="Button1" Grid.Row="12" Grid.Column="1" Grid.ColumnSpan="4" Content="Generate" Click="Button_Click_1" FontFamily="Segoe UI" FontSize="16" Foreground="#FFFFFF" Background="#656868" Height="Auto" Width="Auto" Padding="30,10,30,10" />
<TextBlock x:Name="TextBlock10" Grid.Row="13" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="16"/>
</Grid>
</ContentControl>
</View:SampleLayout.Sample>
</View:SampleLayout>

Просмотреть файл

@ -1,411 +0,0 @@
#region Copyright Syncfusion Inc. 2001-2024.
// Copyright Syncfusion Inc. 2001-2024. All rights reserved.
// Use of this code is subject to the terms of our license.
// A copy of the current license can be obtained at any time by e-mailing
// licensing@syncfusion.com. Any infringement will be prosecuted under
// applicable laws.
#endregion
using Common;
using Syncfusion.DocIO;
using Syncfusion.DocIO.DLS;
using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using Windows.Storage;
using Windows.Storage.Pickers;
using Windows.UI.Popups;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
namespace EssentialDocIO
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class BookmarkNavigationDemo : SampleLayout
{
public override void Dispose()
{
base.Dispose();
DisposeTextBlock(TextBlock1);
TextBlock1 = null;
DisposeTextBlock(TextBlock2);
TextBlock2 = null;
DisposeTextBlock(TextBlock3);
TextBlock3 = null;
DisposeTextBlock(TextBlock4);
TextBlock4 = null;
DisposeTextBlock(TextBlock5);
TextBlock5 = null;
DisposeTextBlock(TextBlock6);
TextBlock6 = null;
DisposeTextBlock(TextBlock7);
TextBlock7 = null;
DisposeTextBlock(TextBlock8);
TextBlock8 = null;
DisposeTextBlock(TextBlock9);
TextBlock9 = null;
DisposeTextBlock(TextBlock10);
TextBlock10 = null;
Button1.Click -= Button_Click_1;
DisposeButton(Button1);
Button1 = null;
Button2.Click -= Button_Click_2;
DisposeButton(Button2);
Button2 = null;
DisposeRadioButton(rdDoc);
rdDoc = null;
DisposeRadioButton(rdDocx);
rdDocx = null;
stackPnlOptions.ClearValue(StackPanel.OrientationProperty);
stackPnlOptions.ClearValue(StackPanel.HorizontalAlignmentProperty);
stackPnlOptions = null;
BookmarkNavigatioin.ClearValue(Grid.BackgroundProperty);
BookmarkNavigatioin.ClearValue(Grid.PaddingProperty);
BookmarkNavigatioin.Children.Clear();
BookmarkNavigatioin.ColumnDefinitions.Clear();
BookmarkNavigatioin.RowDefinitions.Clear();
BookmarkNavigatioin = null;
}
public void DisposeRadioButton(RadioButton radioButton)
{
radioButton.ClearValue(RadioButton.GroupNameProperty);
radioButton.ClearValue(RadioButton.ContentProperty);
radioButton.ClearValue(RadioButton.FontFamilyProperty);
radioButton.ClearValue(RadioButton.FontSizeProperty);
radioButton.ClearValue(RadioButton.ForegroundProperty);
radioButton.ClearValue(RadioButton.WidthProperty);
radioButton.ClearValue(RadioButton.IsCheckedProperty);
}
public void DisposeTextBlock(TextBlock textBlock)
{
textBlock.ClearValue(TextBlock.FontFamilyProperty);
textBlock.ClearValue(TextBlock.FontSizeProperty);
textBlock.ClearValue(TextBlock.TextProperty);
textBlock.ClearValue(TextBlock.TextWrappingProperty);
textBlock.ClearValue(TextBlock.ForegroundProperty);
}
public void DisposeButton(Button button)
{
button.ClearValue(Button.FontFamilyProperty);
button.ClearValue(Button.FontSizeProperty);
button.ClearValue(Button.PaddingProperty);
button.ClearValue(Button.ForegroundProperty);
button.ClearValue(Button.BackgroundProperty);
button.ClearValue(Button.ContentProperty);
button.ClearValue(Button.HeightProperty);
button.ClearValue(Button.WidthProperty);
}
private async void Button_Click_2(object sender, RoutedEventArgs e)
{
Assembly execAssm = typeof(BookmarkNavigationDemo).GetTypeInfo().Assembly;
Stream inputStream = execAssm.GetManifestResourceStream("Syncfusion.SampleBrowser.UWP.DocIO.DocIO.Assets.Bookmark_Template.docx");
MemoryStream stream = new MemoryStream();
inputStream.CopyTo(stream);
inputStream.Dispose();
stream.Position = 0;
ViewTemplate(stream);
}
public BookmarkNavigationDemo()
{
InitializeComponent();
if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons"))
{
BookmarkNavigatioin.Margin = new Thickness(10, 10, 10, 10);
stackPnlOptions.Visibility = Visibility.Collapsed;
TextBlock5.Visibility = Visibility.Collapsed;
TextBlock6.Visibility = Visibility.Collapsed;
TextBlock7.Visibility = Visibility.Collapsed;
TextBlock4.Visibility = Visibility.Collapsed;
}
else
{
stackPnlOptions.Visibility = Visibility.Visible;
TextBlock6.Visibility = Visibility.Visible;
TextBlock5.Visibility = Visibility.Visible;
TextBlock7.Visibility = Visibility.Visible;
}
}
private async void Button_Click_1(object sender, RoutedEventArgs e)
{
Assembly execAssem = typeof(BookmarkNavigationDemo).GetTypeInfo().Assembly;
// Creating a new document.
WordDocument document = new WordDocument();
//Adds section with one empty paragraph to the Word document
document.EnsureMinimal();
//sets the page margins
document.LastSection.PageSetup.Margins.All = 72f;
//Appends bookmark to the paragraph
document.LastParagraph.AppendBookmarkStart("NorthwindDatabase");
document.LastParagraph.AppendText("Northwind database with relational data");
document.LastParagraph.AppendBookmarkEnd("NorthwindDatabase");
// Open an existing template document with single section.
WordDocument nwdInformation = new WordDocument();
Stream inputStream = execAssem.GetManifestResourceStream("Syncfusion.SampleBrowser.UWP.DocIO.DocIO.Assets.Bookmark_Template.docx");
// Open an existing template document.
await nwdInformation.OpenAsync(inputStream, FormatType.Doc);
inputStream.Dispose();
// Open an existing template document with multiple section.
WordDocument templateDocument = new WordDocument();
inputStream = execAssem.GetManifestResourceStream("Syncfusion.SampleBrowser.UWP.DocIO.DocIO.Assets.BkmkDocumentPart_Template.docx");
// Open an existing template document.
await templateDocument.OpenAsync(inputStream, FormatType.Doc);
inputStream.Dispose();
// Creating a bookmark navigator. Which help us to navigate through the
// bookmarks in the template document.
BookmarksNavigator bk = new BookmarksNavigator(templateDocument);
// Move to the NorthWind bookmark in template document
bk.MoveToBookmark("NorthWind");
//Gets the bookmark content as WordDocumentPart
WordDocumentPart documentPart = bk.GetContent();
// Creating a bookmark navigator. Which help us to navigate through the
// bookmarks in the Northwind information document.
bk = new BookmarksNavigator(nwdInformation);
// Move to the information bookmark
bk.MoveToBookmark("Information");
// Get the content of information bookmark.
TextBodyPart bodyPart = bk.GetBookmarkContent();
// Creating a bookmark navigator. Which help us to navigate through the
// bookmarks in the destination document.
bk = new BookmarksNavigator(document);
// Move to the NorthWind database in the destination document
bk.MoveToBookmark("NorthwindDatabase");
//Replace the bookmark content using word document parts
bk.ReplaceContent(documentPart);
// Move to the Northwind_Information in the destination document
bk.MoveToBookmark("Northwind_Information");
// Replacing content of Northwind_Information bookmark.
bk.ReplaceBookmarkContent(bodyPart);
#region Bookmark selection for table
// Creating a bookmark navigator. Which help us to navigate through the
// bookmarks in the Northwind information document.
bk = new BookmarksNavigator(nwdInformation);
bk.MoveToBookmark("SuppliersTable");
//Sets the column index where the bookmark starts within the table
bk.CurrentBookmark.FirstColumn = 1;
//Sets the column index where the bookmark ends within the table
bk.CurrentBookmark.LastColumn = 5;
// Get the content of suppliers table bookmark.
bodyPart = bk.GetBookmarkContent();
// Creating a bookmark navigator. Which help us to navigate through the
// bookmarks in the destination document.
bk = new BookmarksNavigator(document);
bk.MoveToBookmark("Table");
bk.ReplaceBookmarkContent(bodyPart);
#endregion
// Move to the text bookmark
bk.MoveToBookmark("Text");
//Deletes the bookmark content
bk.DeleteBookmarkContent(true);
// Inserting text inside the bookmark. This will preserve the source formatting
bk.InsertText("Northwind Database contains the following table:");
#region tableinsertion
WTable tbl = new WTable(document);
tbl.TableFormat.Borders.BorderType = BorderStyle.None;
tbl.TableFormat.IsAutoResized = true;
tbl.ResetCells(8, 2);
IWParagraph paragraph;
tbl.Rows[0].IsHeader = true;
paragraph = tbl[0, 0].AddParagraph();
paragraph.AppendText("Suppliers");
paragraph.BreakCharacterFormat.FontName = "Calibri";
paragraph.BreakCharacterFormat.FontSize = 10;
paragraph = tbl[0, 1].AddParagraph();
paragraph.AppendText("1");
paragraph.BreakCharacterFormat.FontName = "Calibri";
paragraph.BreakCharacterFormat.FontSize = 10;
paragraph = tbl[1, 0].AddParagraph();
paragraph.AppendText("Customers");
paragraph.BreakCharacterFormat.FontName = "Calibri";
paragraph.BreakCharacterFormat.FontSize = 10;
paragraph = tbl[1, 1].AddParagraph();
paragraph.AppendText("1");
paragraph.BreakCharacterFormat.FontName = "Calibri";
paragraph.BreakCharacterFormat.FontSize = 10;
paragraph = tbl[2, 0].AddParagraph();
paragraph.AppendText("Employees");
paragraph.BreakCharacterFormat.FontName = "Calibri";
paragraph.BreakCharacterFormat.FontSize = 10;
paragraph = tbl[2, 1].AddParagraph();
paragraph.AppendText("3");
paragraph.BreakCharacterFormat.FontName = "Calibri";
paragraph.BreakCharacterFormat.FontSize = 10;
paragraph = tbl[3, 0].AddParagraph();
paragraph.AppendText("Products");
paragraph.BreakCharacterFormat.FontName = "Calibri";
paragraph.BreakCharacterFormat.FontSize = 10;
paragraph = tbl[3, 1].AddParagraph();
paragraph.AppendText("1");
paragraph.BreakCharacterFormat.FontName = "Calibri";
paragraph.BreakCharacterFormat.FontSize = 10;
paragraph = tbl[4, 0].AddParagraph();
paragraph.AppendText("Inventory");
paragraph.BreakCharacterFormat.FontName = "Calibri";
paragraph.BreakCharacterFormat.FontSize = 10;
paragraph = tbl[4, 1].AddParagraph();
paragraph.AppendText("2");
paragraph.BreakCharacterFormat.FontName = "Calibri";
paragraph.BreakCharacterFormat.FontSize = 10;
paragraph = tbl[5, 0].AddParagraph();
paragraph.AppendText("Shippers");
paragraph.BreakCharacterFormat.FontName = "Calibri";
paragraph.BreakCharacterFormat.FontSize = 10;
paragraph = tbl[5, 1].AddParagraph();
paragraph.AppendText("1");
paragraph.BreakCharacterFormat.FontName = "Calibri";
paragraph.BreakCharacterFormat.FontSize = 10;
paragraph = tbl[6, 0].AddParagraph();
paragraph.AppendText("PO Transactions");
paragraph.BreakCharacterFormat.FontName = "Calibri";
paragraph.BreakCharacterFormat.FontSize = 10;
paragraph = tbl[6, 1].AddParagraph();
paragraph.AppendText("3");
paragraph.BreakCharacterFormat.FontName = "Calibri";
paragraph.BreakCharacterFormat.FontSize = 10;
paragraph = tbl[7, 0].AddParagraph();
paragraph.AppendText("Sales Transactions");
paragraph.BreakCharacterFormat.FontName = "Calibri";
paragraph.BreakCharacterFormat.FontSize = 10;
paragraph = tbl[7, 1].AddParagraph();
paragraph.AppendText("7");
paragraph.BreakCharacterFormat.FontName = "Calibri";
paragraph.BreakCharacterFormat.FontSize = 10;
bk.InsertTable(tbl);
#endregion
//Move to image bookmark
bk.MoveToBookmark("Image");
//Deletes the bookmark
bk.DeleteBookmarkContent(true);
// Inserting image to the bookmark.
IWPicture pic = bk.InsertParagraphItem(ParagraphItemType.Picture) as WPicture;
inputStream = execAssem.GetManifestResourceStream("Syncfusion.SampleBrowser.UWP.DocIO.DocIO.Assets.Northwind.png");
pic.LoadImage(inputStream);
inputStream.Dispose();
pic.WidthScale = 50f; // It reduce the image size because it don't fit
pic.HeightScale = 75f; // in document page.
Save(rdDoc.IsChecked == true, document);
}
private async void Save(bool isDocFormat, WordDocument document)
{
StorageFile stgFile;
if (!(Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons")))
{
FileSavePicker savePicker = new FileSavePicker();
savePicker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary;
// Dropdown of file types the user can save the file as
if (isDocFormat)
savePicker.FileTypeChoices.Add("Word Document", new List<string>() { ".doc" });
else
savePicker.FileTypeChoices.Add("Word Document", new List<string>() { ".docx" });
// Default file name if the user does not type one in or select a file to replace
savePicker.SuggestedFileName = "Bookmark Navigation";
stgFile = await savePicker.PickSaveFileAsync();
}
else
{
StorageFolder local = Windows.Storage.ApplicationData.Current.LocalFolder;
stgFile = await local.CreateFileAsync("WordDocument.docx", CreationCollisionOption.ReplaceExisting);
}
if (stgFile != null)
{
MemoryStream stream = new MemoryStream();
if (isDocFormat)
await document.SaveAsync(stream, FormatType.Doc);
else
await document.SaveAsync(stream, FormatType.Docx);
document.Close();
stream.Position = 0;
Windows.Storage.Streams.IRandomAccessStream fileStream = await stgFile.OpenAsync(FileAccessMode.ReadWrite);
Stream st = fileStream.AsStreamForWrite();
st.SetLength(0);
st.Write((stream as MemoryStream).ToArray(), 0, (int)stream.Length);
st.Flush();
st.Dispose();
fileStream.Dispose();
//Save as Docx Format
MessageDialog msgDialog = new MessageDialog("Do you want to view the Document?", "File has been created successfully.");
UICommand yesCmd = new UICommand("Yes");
msgDialog.Commands.Add(yesCmd);
UICommand noCmd = new UICommand("No");
msgDialog.Commands.Add(noCmd);
IUICommand cmd = await msgDialog.ShowAsync();
if (cmd == yesCmd)
{
// Launch the retrieved file
bool success = await Windows.System.Launcher.LaunchFileAsync(stgFile);
}
}
}
private async void ViewTemplate(MemoryStream stream)
{
StorageFile stgFile;
if (!(Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons")))
{
FileSavePicker savePicker = new FileSavePicker();
savePicker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary;
// Dropdown of file types the user can save the file as
savePicker.FileTypeChoices.Add("Word Document", new List<string>() { ".docx" });
// Default file name if the user does not type one in or select a file to replace
savePicker.SuggestedFileName = "Bookmark_Template";
stgFile = await savePicker.PickSaveFileAsync();
}
else
{
StorageFolder local = Windows.Storage.ApplicationData.Current.LocalFolder;
stgFile = await local.CreateFileAsync("Bookmark_Template.docx", CreationCollisionOption.ReplaceExisting);
}
if (stgFile != null)
{
stream.Position = 0;
Windows.Storage.Streams.IRandomAccessStream fileStream = await stgFile.OpenAsync(FileAccessMode.ReadWrite);
Stream st = fileStream.AsStreamForWrite();
st.SetLength(0);
st.Write((stream as MemoryStream).ToArray(), 0, (int)stream.Length);
st.Flush();
st.Dispose();
fileStream.Dispose();
//Save as Docx Format
MessageDialog msgDialog = new MessageDialog("Do you want to view the Document?", "File has been created successfully.");
UICommand yesCmd = new UICommand("Yes");
msgDialog.Commands.Add(yesCmd);
UICommand noCmd = new UICommand("No");
msgDialog.Commands.Add(noCmd);
IUICommand cmd = await msgDialog.ShowAsync();
if (cmd == yesCmd)
{
// Launch the retrieved file
bool success = await Windows.System.Launcher.LaunchFileAsync(stgFile);
}
}
}
}
}

Просмотреть файл

@ -1,45 +0,0 @@
<View:SampleLayout
x:Class="EssentialDocIO.CompareDocumentsDemo"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:EssentialDocIO" xmlns:View="using:Common"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<View:SampleLayout.Sample>
<ContentControl>
<Grid x:Name="CompareDocuments" Background="{StaticResource ApplicationPageBackgroundThemeBrush}" Padding="10,0,0,0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock x:Name="TextBlock1" Grid.Row="0" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="18"/>
<TextBlock x:Name="WinRTText1" Grid.Row="1" Grid.ColumnSpan="4" TextWrapping="Wrap" Text="This sample demonstrates how to compare two Word documents using .NET Word (DocIO) library. With this, you can easily identify the changes between two versions of a document." FontFamily="Segoe UI" FontSize="20" Foreground="#333333"/>
<TextBlock x:Name="TextBlock2" Grid.Row="2" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="18"/>
<TextBlock x:Name="WinRTText2" Grid.Row="3" Grid.ColumnSpan="4" TextWrapping="Wrap" Text="Click the button to view the generated Word document. Please note that Microsoft Word Viewer or Microsoft Word is required to view the resultant Word document." FontFamily="Segoe UI" FontSize="16" Foreground="#333333"/>
<TextBlock x:Name="TextBlock5" Grid.Row="4" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="16"/>
<TextBlock x:Name="TextBlock3" Grid.Row="6" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="16"/>
<Button x:Name="Button1" Grid.Row="12" Grid.ColumnSpan="4" Content="Compare Documents" Click="Button_Click_1" FontFamily="Segoe UI" FontSize="16" Foreground="#FFFFFF" Background="#656868" Height="Auto" Width="Auto" Padding="30,10,30,10" />
<TextBlock x:Name="TextBlock4" Grid.Row="13" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="16"/>
</Grid>
</ContentControl>
</View:SampleLayout.Sample>
</View:SampleLayout>

Просмотреть файл

@ -1,149 +0,0 @@
#region Copyright Syncfusion Inc. 2001 - 2024
// Copyright Syncfusion Inc. 2001 - 2024. All rights reserved.
// Use of this code is subject to the terms of our license.
// A copy of the current license can be obtained at any time by e-mailing
// licensing@syncfusion.com. Any infringement will be prosecuted under
// applicable laws.
#endregion
using Common;
using Syncfusion.DocIO;
using Syncfusion.DocIO.DLS;
using System;
using System.Collections.Generic;
using System.IO;
using Windows.Storage;
using Windows.Storage.Pickers;
using Windows.UI.Popups;
using Windows.UI.Xaml;
using System.Reflection;
using Windows.UI.Xaml.Controls;
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
namespace EssentialDocIO
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class CompareDocumentsDemo : SampleLayout
{
#region Fields
Assembly execAssm = typeof(CompareDocumentsDemo).GetTypeInfo().Assembly;
#endregion
public CompareDocumentsDemo()
{
this.InitializeComponent();
}
public override void Dispose()
{
base.Dispose();
DisposeTextBlock(TextBlock1);
TextBlock1 = null;
DisposeTextBlock(TextBlock2);
TextBlock2 = null;
DisposeTextBlock(TextBlock3);
TextBlock3 = null;
DisposeTextBlock(TextBlock4);
TextBlock4 = null;
DisposeTextBlock(TextBlock5);
TextBlock5 = null;
DisposeTextBlock(WinRTText1);
WinRTText1 = null;
DisposeTextBlock(WinRTText2);
WinRTText2 = null;
Button1.Click -= Button_Click_1;
DisposeButton(Button1);
Button1 = null;
CompareDocuments.ClearValue(Grid.BackgroundProperty);
CompareDocuments.ClearValue(Grid.PaddingProperty);
CompareDocuments.Children.Clear();
CompareDocuments.ColumnDefinitions.Clear();
CompareDocuments.RowDefinitions.Clear();
CompareDocuments = null;
}
public void DisposeTextBlock(TextBlock textBlock)
{
textBlock.ClearValue(TextBlock.FontFamilyProperty);
textBlock.ClearValue(TextBlock.FontSizeProperty);
textBlock.ClearValue(TextBlock.TextProperty);
textBlock.ClearValue(TextBlock.TextWrappingProperty);
textBlock.ClearValue(TextBlock.ForegroundProperty);
}
public void DisposeButton(Button button)
{
button.ClearValue(Button.FontFamilyProperty);
button.ClearValue(Button.FontSizeProperty);
button.ClearValue(Button.PaddingProperty);
button.ClearValue(Button.ForegroundProperty);
button.ClearValue(Button.BackgroundProperty);
button.ClearValue(Button.ContentProperty);
button.ClearValue(Button.HeightProperty);
button.ClearValue(Button.WidthProperty);
}
private async void Button_Click_1(object sender, RoutedEventArgs e)
{
//Loads the original document.
Stream originalDocumentStreamPath = typeof(CompareDocumentsDemo).GetTypeInfo().Assembly.GetManifestResourceStream("Syncfusion.SampleBrowser.UWP.DocIO.DocIO.Assets.OriginalDocument.docx");
WordDocument originalDocument = new WordDocument();
//Open Template document
await originalDocument.OpenAsync(originalDocumentStreamPath, FormatType.Docx);
//Loads the revised document.
Stream revisedDocumentStreamPath = typeof(CompareDocumentsDemo).GetTypeInfo().Assembly.GetManifestResourceStream("Syncfusion.SampleBrowser.UWP.DocIO.DocIO.Assets.RevisedDocument.docx");
WordDocument revisedDocument = new WordDocument();
await revisedDocument.OpenAsync(revisedDocumentStreamPath, FormatType.Docx);
//Compares the original document with revised document
originalDocument.Compare(revisedDocument, "Nancy Davolio", DateTime.Now.AddDays(-1));
originalDocumentStreamPath.Dispose();
revisedDocumentStreamPath.Dispose();
revisedDocument.Close();
Save(originalDocument);
}
private async void Save(WordDocument document)
{
StorageFile stgFile;
if (!(Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons")))
{
FileSavePicker savePicker = new FileSavePicker();
savePicker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary;
savePicker.FileTypeChoices.Add("Word Document", new List<string>() { ".docx" });
// Default file name if the user does not type one in or select a file to replace
savePicker.SuggestedFileName = "CompareDocuments";
stgFile = await savePicker.PickSaveFileAsync();
}
else
{
StorageFolder local = Windows.Storage.ApplicationData.Current.LocalFolder;
stgFile = await local.CreateFileAsync("CompareDocuments.docx", CreationCollisionOption.ReplaceExisting);
}
if (stgFile != null)
{
MemoryStream stream = new MemoryStream();
await document.SaveAsync(stream, FormatType.Docx);
document.Close();
stream.Position = 0;
Windows.Storage.Streams.IRandomAccessStream fileStream = await stgFile.OpenAsync(FileAccessMode.ReadWrite);
Stream st = fileStream.AsStreamForWrite();
st.SetLength(0);
st.Write((stream as MemoryStream).ToArray(), 0, (int)stream.Length);
st.Flush();
st.Dispose();
fileStream.Dispose();
MessageDialog msgDialog = new MessageDialog("Do you want to view the Document?", "File has been created successfully.");
UICommand yesCmd = new UICommand("Yes");
msgDialog.Commands.Add(yesCmd);
UICommand noCmd = new UICommand("No");
msgDialog.Commands.Add(noCmd);
IUICommand cmd = await msgDialog.ShowAsync();
if (cmd == yesCmd)
{
// Launch the retrieved file
bool success = await Windows.System.Launcher.LaunchFileAsync(stgFile);
}
}
}
}
}

Просмотреть файл

@ -1,43 +0,0 @@
<View:SampleLayout
x:Class="EssentialDocIO.CreateEquationDemo"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:EssentialDocIO" xmlns:View="using:Common"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<View:SampleLayout.Sample>
<ContentControl>
<Grid x:Name="CreateEquation" Background="{StaticResource ApplicationPageBackgroundThemeBrush}" Padding="10,0,0,0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock x:Name="TextBlock1" Grid.Row="0" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="18"/>
<TextBlock x:Name="TextBlock2" Grid.Row="1" Grid.ColumnSpan="4" TextWrapping="Wrap" Text="This sample demonstrates how to create a Word document with mathematical equations using Essential DocIO." FontFamily="Segoe UI" FontSize="20" Foreground="#333333"/>
<TextBlock x:Name="TextBlock3" Grid.Row="2" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="18"/>
<TextBlock x:Name="TextBlock4" Grid.Row="3" Grid.ColumnSpan="4" TextWrapping="Wrap" Text="Please click the Generate button to save and view the Word document generated by Essential DocIO." FontFamily="Segoe UI" FontSize="16" Foreground="#333333"/>
<TextBlock x:Name="TextBlock5" Grid.Row="4" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="16"/>
<TextBlock x:Name="TextBlock6" Grid.Row="6" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="14"/>
<Button x:Name="Button1" Grid.Row="10" Grid.ColumnSpan="4" Content="Generate" Click="Button_Click_1" FontFamily="Segoe UI" FontSize="16" Foreground="#FFFFFF" Background="#656868" Padding="30,10,30,10"/>
<TextBlock x:Name="TextBlock7" Grid.Row="11" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="16"/>
</Grid>
</ContentControl>
</View:SampleLayout.Sample>
</View:SampleLayout>

Просмотреть файл

@ -1,729 +0,0 @@
#region Copyright Syncfusion Inc. 2001-2024.
// Copyright Syncfusion Inc. 2001-2024. All rights reserved.
// Use of this code is subject to the terms of our license.
// A copy of the current license can be obtained at any time by e-mailing
// licensing@syncfusion.com. Any infringement will be prosecuted under
// applicable laws.
#endregion
using Common;
using Syncfusion.DocIO;
using Syncfusion.DocIO.DLS;
using Syncfusion.Office;
using System;
using System.Collections.Generic;
using System.IO;
using Windows.Storage;
using Windows.Storage.Pickers;
using Windows.UI.Popups;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
namespace EssentialDocIO
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class CreateEquationDemo : SampleLayout
{
public CreateEquationDemo()
{
InitializeComponent();
if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons"))
{
TextBlock4.Visibility = Visibility.Collapsed;
}
}
public override void Dispose()
{
base.Dispose();
DisposeTextBlock(TextBlock1);
TextBlock1 = null;
DisposeTextBlock(TextBlock2);
TextBlock2 = null;
DisposeTextBlock(TextBlock3);
TextBlock3 = null;
DisposeTextBlock(TextBlock4);
TextBlock4 = null;
DisposeTextBlock(TextBlock5);
TextBlock5 = null;
DisposeTextBlock(TextBlock6);
TextBlock6 = null;
DisposeTextBlock(TextBlock7);
TextBlock7 = null;
Button1.Click -= Button_Click_1;
DisposeButton(Button1);
Button1 = null;
CreateEquation.ClearValue(Grid.BackgroundProperty);
CreateEquation.ClearValue(Grid.PaddingProperty);
CreateEquation.Children.Clear();
CreateEquation.ColumnDefinitions.Clear();
CreateEquation.RowDefinitions.Clear();
CreateEquation = null;
}
public void DisposeTextBlock(TextBlock textBlock)
{
textBlock.ClearValue(TextBlock.FontFamilyProperty);
textBlock.ClearValue(TextBlock.FontSizeProperty);
textBlock.ClearValue(TextBlock.TextProperty);
textBlock.ClearValue(TextBlock.TextWrappingProperty);
textBlock.ClearValue(TextBlock.ForegroundProperty);
}
public void DisposeButton(Button button)
{
button.ClearValue(Button.FontFamilyProperty);
button.ClearValue(Button.FontSizeProperty);
button.ClearValue(Button.PaddingProperty);
button.ClearValue(Button.ForegroundProperty);
button.ClearValue(Button.BackgroundProperty);
button.ClearValue(Button.ContentProperty);
}
private void Button_Click_1(object sender, RoutedEventArgs e)
{
//Creates a new word document instance
WordDocument document = new WordDocument();
//Adds new section to the document
IWSection section = document.AddSection();
//Sets page margins
document.LastSection.PageSetup.Margins.All = 72;
//Adds new paragraph to the section
IWParagraph paragraph = section.AddParagraph();
//Appends text to paragraph
IWTextRange textRange = paragraph.AppendText("Mathematical equations");
textRange.CharacterFormat.FontSize = 28;
paragraph.ParagraphFormat.HorizontalAlignment = Syncfusion.DocIO.DLS.HorizontalAlignment.Center;
paragraph.ParagraphFormat.AfterSpacing = 12;
#region Sum to the power of n
//Adds new paragraph to the section
paragraph = AddParagraph(section, "This is an expansion of the sum (1+X) to the power of n.");
//Creates an equation with sum to the power of N
CreateSumToThePowerOfN(paragraph);
#endregion
#region Fourier series
//Adds new paragraph to the section
paragraph = AddParagraph(section, "This is a Fourier series for the function of period 2L");
//Creates a Fourier series equation
CreateFourierseries(paragraph);
#endregion
#region Triple scalar product
//Adds new paragraph to the section
paragraph = AddParagraph(section, "This is an expansion of triple scalar product");
//Creates a triple scalar product equation
CreateTripleScalarProduct(paragraph);
#endregion
#region Gamma function
//Adds new paragraph to the section
paragraph = AddParagraph(section, "This is an expansion of gamma function");
//Creates a gamma function equation
CreateGammaFunction(paragraph);
#endregion
#region Vector relation
//Adds new paragraph to the section
paragraph = AddParagraph(section, "This is an expansion of vector relation ");
//Creates a vector relation equation
CreateVectorRelation(paragraph);
#endregion
SaveDocx(document);
}
/// <summary>
/// Save as Docx Format
/// </summary>
/// <param name="doc"></param>
private async void SaveDocx(WordDocument doc)
{
StorageFile stgFile;
if (!(Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons")))
{
FileSavePicker savePicker = new FileSavePicker();
savePicker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary;
// Dropdown of file types the user can save the file as
savePicker.FileTypeChoices.Add("Word Document", new List<string>() { ".docx" });
// Default file name if the user does not type one in or select a file to replace
savePicker.SuggestedFileName = "Sample";
stgFile = await savePicker.PickSaveFileAsync();
}
else
{
StorageFolder local = Windows.Storage.ApplicationData.Current.LocalFolder;
stgFile = await local.CreateFileAsync("WordDocument.docx", CreationCollisionOption.ReplaceExisting);
}
if (stgFile != null)
{
MemoryStream stream = new MemoryStream();
await doc.SaveAsync(stream, FormatType.Docx);
doc.Close();
stream.Position = 0;
Windows.Storage.Streams.IRandomAccessStream fileStream = await stgFile.OpenAsync(FileAccessMode.ReadWrite);
Stream st = fileStream.AsStreamForWrite();
st.SetLength(0);
st.Write((stream as MemoryStream).ToArray(), 0, (int)stream.Length);
st.Flush();
st.Dispose();
fileStream.Dispose();
//Save as Docx Format
MessageDialog msgDialog = new MessageDialog("Do you want to view the Document?", "File has been created successfully.");
UICommand yesCmd = new UICommand("Yes");
msgDialog.Commands.Add(yesCmd);
UICommand noCmd = new UICommand("No");
msgDialog.Commands.Add(noCmd);
IUICommand cmd = await msgDialog.ShowAsync();
if (cmd == yesCmd)
{
// Launch the retrieved file
bool success = await Windows.System.Launcher.LaunchFileAsync(stgFile);
}
}
}
#region Helper Methods
/// <summary>
/// Adds new paragraph into the section
/// </summary>
/// <param name="section">Represents a section in Word document</param>
/// <param name="text">Represents a text to append in paragraph</param>
/// <returns>Returns a paragraph to add equation</returns>
private IWParagraph AddParagraph(IWSection section, string text)
{
//Adds new paragraph to the section
IWParagraph paragraph = section.AddParagraph();
//Adds new paragraph to add text
paragraph = section.AddParagraph();
//Appends text to paragraph
paragraph.AppendText(text);
paragraph.ParagraphFormat.AfterSpacing = 12;
paragraph.ParagraphFormat.BeforeSpacing = 12;
//Adds new paragraph to add equation
paragraph = section.AddParagraph();
paragraph.ParagraphFormat.AfterSpacing = 12;
return paragraph;
}
/// <summary>
/// Creates an expansion of triple scalar product
/// </summary>
/// <param name="paragraph">Represents a paragraph to add MathML element</param>
private void CreateTripleScalarProduct(IWParagraph paragraph)
{
WordDocument document = paragraph.Document;
//Creates a MathML element
WMath math = paragraph.AppendMath();
//Adds an office math
IOfficeMath officeMath = math.MathParagraph.Maths.Add();
#region Math text
//Unicode value of middle dot
string middleDot = "\u00B7";
string multiplicationSign = "\u00D7";
string text = "A" + middleDot + "B" + multiplicationSign + "C";
//Adds a math item
IOfficeMathRunElement officeMathParaItem = AddMathText(document, officeMath, text);
//Sets style for math text
officeMathParaItem.MathFormat.Style = MathStyleType.Bold;
//Adds math text
officeMathParaItem = AddMathText(document, officeMath, "=");
//Sets style for math text
officeMathParaItem.MathFormat.Style = MathStyleType.Bold;
//Adds math text
text = "A" + multiplicationSign + "B" + middleDot + "C";
officeMathParaItem = AddMathText(document, officeMath, text);
//Sets style for math text
officeMathParaItem.MathFormat.Style = MathStyleType.Bold;
//Adds math text
officeMathParaItem = AddMathText(document, officeMath, "=");
#endregion
#region Delimiter
//Adds a delimiter
IOfficeMathDelimiter mathDelimiter = officeMath.Functions.Add(MathFunctionType.Delimiter) as IOfficeMathDelimiter;
//Sets begin character for delimiter
mathDelimiter.BeginCharacter = "|";
//Sets end character for delimiter
mathDelimiter.EndCharacter = "|";
//Apply formats for delimiter
mathDelimiter.ControlProperties = new WCharacterFormat(document);
(mathDelimiter.ControlProperties as WCharacterFormat).Italic = true;
//Adds arguments for delimiter
officeMath = mathDelimiter.Equation.Add() as IOfficeMath;
#region Matrix
//Add matrix into delimiter
IOfficeMathMatrix mathMatrix = officeMath.Functions.Add(MathFunctionType.Matrix) as IOfficeMathMatrix;
//Add columns in matrix
mathMatrix.Columns.Add();
mathMatrix.Columns.Add();
mathMatrix.Columns.Add();
#region First row
//Adds a new row
IOfficeMathMatrixRow mathMatrixRow = mathMatrix.Rows.Add();
///Add values to row
AddMatrixRowValues(document, mathMatrixRow, "A");
#endregion
#region Second row
//Adds a new row
mathMatrixRow = mathMatrix.Rows.Add();
///Add values to row
AddMatrixRowValues(document, mathMatrixRow, "B");
#endregion
#region Third row
//Adds a new row
mathMatrixRow = mathMatrix.Rows.Add();
///Add values to row
AddMatrixRowValues(document, mathMatrixRow, "C");
#endregion
#endregion
#endregion
}
/// <summary>
/// Creates an expansion of vector relation
/// </summary>
/// <param name="paragraph">Represents a paragraph to add MathML element</param>
private void CreateVectorRelation(IWParagraph paragraph)
{
WordDocument document = paragraph.Document;
//Creates a MathML element
WMath math = paragraph.AppendMath();
IOfficeMath officeMath = math.MathParagraph.Maths.Add();
//Adds an accent equation
AddMathAccent(document, officeMath, 8407, "A");
//Adds a math text
string middleDot = "\u00B7";
officeMath = math.MathParagraph.Maths.Add();
IOfficeMathRunElement officeMathParaItem = AddMathText(document, officeMath, middleDot);
//Adds an accent equation
officeMath = math.MathParagraph.Maths.Add();
AddMathAccent(document, officeMath, 8407, "B");
//Adds a math text
officeMath = math.MathParagraph.Maths.Add();
string multiplicationSign = "\u00D7";
officeMathParaItem = AddMathText(document, officeMath, multiplicationSign);
//Adds an accent equation
officeMath = math.MathParagraph.Maths.Add();
AddMathAccent(document, officeMath, 8407, "C");
//Adds a math text
officeMath = math.MathParagraph.Maths.Add();
officeMathParaItem = AddMathText(document, officeMath, "=");
//Adds an accent equation
officeMath = math.MathParagraph.Maths.Add();
AddMathAccent(document, officeMath, 8407, "A");
//Adds a math text
officeMath = math.MathParagraph.Maths.Add();
officeMathParaItem = AddMathText(document, officeMath, multiplicationSign);
//Adds an accent equation
officeMath = math.MathParagraph.Maths.Add();
AddMathAccent(document, officeMath, 8407, "B");
//Adds a math text
officeMath = math.MathParagraph.Maths.Add();
officeMathParaItem = AddMathText(document, officeMath, middleDot);
//Adds an accent equation
officeMath = math.MathParagraph.Maths.Add();
AddMathAccent(document, officeMath, 8407, "C");
}
/// <summary>
/// Converts short value to string
/// </summary>
/// <param name="value">Represents a short value</param>
private static string ConvertShortToString(short value)
{
char chrValue = Convert.ToChar(value);
string strValue = Convert.ToString(chrValue);
return strValue;
}
/// <summary>
/// Creates an equation with sum to the power of N
/// </summary>
/// <param name="paragraph">Represents a paragraph to add MathML element</param>
private void CreateSumToThePowerOfN(IWParagraph paragraph)
{
WordDocument document = paragraph.Document;
//Creates a new MathML element
WMath math = paragraph.AppendMath();
IOfficeMath officeMath = math.MathParagraph.Maths.Add();
//Adds a math script element
IOfficeMathScript mathScript = AddMathScript(officeMath, MathScriptType.Superscript);
#region Delimiter equation
//Adds a delimiter
IOfficeMathDelimiter mathDelimiter = mathScript.Equation.Functions.Add(MathFunctionType.Delimiter) as IOfficeMathDelimiter;
//Adds an office math in the delimiter
officeMath = mathDelimiter.Equation.Add() as IOfficeMath;
//Adds a math text
IOfficeMathRunElement mathParaItem = AddMathText(document, officeMath, "1+x");
//Adds a math text
mathParaItem = AddMathText(document, mathScript.Script, "n");
#endregion
//Adds a math text
officeMath = math.MathParagraph.Maths.Add(1);
mathParaItem = AddMathText(document, officeMath, "=1+");
#region Fraction equation
//Adds a math fraction
IOfficeMathFraction mathFraction = math.MathParagraph.Maths.Add().Functions.Add(MathFunctionType.Fraction) as IOfficeMathFraction;
//Adds a numerator text
AddMathText(document, mathFraction.Numerator, "nx");
//Adds a denominator text
AddMathText(document, mathFraction.Denominator, "1!");
#endregion
//Adds a math text
officeMath = math.MathParagraph.Maths.Add();
mathParaItem = AddMathText(document, officeMath, "+");
#region Fraction equation
//Adds a math fraction
mathFraction = math.MathParagraph.Maths.Add().Functions.Add(MathFunctionType.Fraction) as IOfficeMathFraction;
#region Numerator
//Adds a numerator text
AddMathText(document, mathFraction.Numerator, "n");
//Adds a delimiter
mathDelimiter = mathFraction.Numerator.Functions.Add(MathFunctionType.Delimiter) as IOfficeMathDelimiter;
//Adds a math text for delimiter
officeMath = mathDelimiter.Equation.Add() as IOfficeMath;
AddMathText(document, officeMath, "n-1");
//Adds a math script
mathScript = mathFraction.Numerator.Functions.Add(MathFunctionType.SubSuperscript) as IOfficeMathScript;
//Adds a math text for Superscript
AddMathText(document, mathScript.Equation, "x");
AddMathText(document, mathScript.Script, "2");
#endregion
#region Denominator
//Adds a math text for denominator
AddMathText(document, mathFraction.Denominator, "2!");
#endregion
#endregion
//Adds a math text
officeMath = math.MathParagraph.Maths.Add();
AddMathText(document, officeMath, "+...");
}
/// <summary>
/// Creates an expansion of Gamma function
/// </summary>
/// <param name="paragraph">Represents a paragraph to add MathML element</param>
private void CreateGammaFunction(IWParagraph paragraph)
{
WordDocument document = paragraph.Document;
//Creates a new MathML element
WMath math = paragraph.AppendMath();
//Adds a math text
IOfficeMath officeMath = math.MathParagraph.Maths.Add();
//Unicode value of capital gamma
string capitalGamma = "\u0393";
IOfficeMathRunElement officeMathParaItem = AddMathText(document, officeMath, capitalGamma);
//Sets MathML style format for the text
officeMathParaItem.MathFormat.Style = MathStyleType.Regular;
//Adds a delimiter equation
IOfficeMathDelimiter mathDelimiter = math.MathParagraph.Maths.Add().Functions.Add(MathFunctionType.Delimiter) as IOfficeMathDelimiter;
//Adds a equation to the delimiter
officeMath = mathDelimiter.Equation.Add();
//Adds a math text
officeMathParaItem = AddMathText(document, officeMath, "z");
//Adds a math text
officeMath = math.MathParagraph.Maths.Add();
officeMathParaItem = AddMathText(document, officeMath, "=");
//Adds an n array element
IOfficeMathNArray mathNAry = math.MathParagraph.Maths.Add().Functions.Add(MathFunctionType.NArray) as IOfficeMathNArray;
//Adds a math text
AddMathText(document, mathNAry.Subscript, "0");
//Adds a math text
string infinitySymbol = "\u221E";
AddMathText(document, mathNAry.Superscript, infinitySymbol);
//Adds a math superscript
IOfficeMathScript mathScript = AddMathScript(mathNAry.Equation, MathScriptType.Superscript);
//Adds a math text for Superscript
AddMathText(document, mathScript.Equation, "t");
AddMathText(document, mathScript.Script, "z-1");
//Adds a Superscript
mathScript = AddMathScript(mathNAry.Equation, MathScriptType.Superscript);
AddMathText(document, mathScript.Equation, "e");
AddMathText(document, mathScript.Script, "-t");
//Adds a math text in n Array equation
AddMathText(document, mathNAry.Equation, "dt");
//Adds a math text
AddMathText(document, math.MathParagraph.Maths.Add(), "=");
//Adds a fraction equation
IOfficeMathFraction mathFraction = math.MathParagraph.Maths.Add().Functions.Add(MathFunctionType.Fraction) as IOfficeMathFraction;
//Adds a math script
mathScript = AddMathScript(mathFraction.Numerator, MathScriptType.Superscript);
//Adds a math text for Superscript
AddMathText(document, mathScript.Equation, "e");
AddMathText(document, mathScript.Script, "-");
//Unicode of small gamma
string smallGamma = "\u03B3";
AddMathText(document, mathScript.Script, smallGamma);
AddMathText(document, mathScript.Script, "z");
//Adds a math text for denominator
AddMathText(document, mathFraction.Denominator, "z");
//Adds an n-array element
mathNAry = math.MathParagraph.Maths.Add().Functions.Add(MathFunctionType.NArray) as IOfficeMathNArray;
//Unicode value of n-array product
string symbol = "\u220F";
//Adds a n-array character
mathNAry.NArrayCharacter = symbol;
//Adds a math text
AddMathText(document, mathNAry.Subscript, "k=1");
//Adds a math text
AddMathText(document, mathNAry.Superscript, infinitySymbol);
//Adds a math script
mathScript = AddMathScript(mathNAry.Equation, MathScriptType.Superscript);
//Adds a math delimiter element
mathDelimiter = mathScript.Equation.Functions.Add(MathFunctionType.Delimiter) as IOfficeMathDelimiter;
//Adds a equation to the delimiter equation collection
officeMath = mathDelimiter.Equation.Add();
//Adds a math text
AddMathText(document, officeMath, "1+");
//Adds a fraction element
mathFraction = officeMath.Functions.Add(MathFunctionType.Fraction) as IOfficeMathFraction;
//Adds a math text for numerator
AddMathText(document, mathFraction.Numerator, "z");
//Adds a math text for denominator
AddMathText(document, mathFraction.Denominator, "k");
//Adds a math text
AddMathText(document, mathScript.Script, "-1");
//Adds a Superscript equation
mathScript = AddMathScript(mathNAry.Equation, MathScriptType.Superscript);
//Adds a math text for Superscript
AddMathText(document, mathScript.Equation, "e");
AddMathText(document, mathScript.Script, "z");
officeMathParaItem = AddMathText(document, mathScript.Script, "/");
officeMathParaItem.MathFormat.HasLiteral = true;
AddMathText(document, mathScript.Script, "k");
//Adds a math text
AddMathText(document, math.MathParagraph.Maths.Add(), ",");
//Adds a math text
officeMathParaItem = AddMathText(document, math.MathParagraph.Maths.Add(), " ");
//Sets style for math text
officeMathParaItem.MathFormat.Style = MathStyleType.Regular;
//Adds a math text
AddMathText(document, math.MathParagraph.Maths.Add(), smallGamma);
string text = "\u2248" + "0.577216";
AddMathText(document, math.MathParagraph.Maths.Add(), text);
}
/// <summary>
/// Creates a Fourier series equation
/// </summary>
/// <param name="paragraph">Represents a paragraph to add MathML element</param>
private void CreateFourierseries(IWParagraph paragraph)
{
WordDocument document = paragraph.Document;
//Creates a new MathML element
WMath math = paragraph.AppendMath();
//Adds a math
IOfficeMath officeMath = math.MathParagraph.Maths.Add();
//Adds a math text
AddMathText(document, officeMath, "f");
//Adds a math delimiter
IOfficeMathDelimiter mathDelimiter = math.MathParagraph.Maths.Add().Functions.Add(MathFunctionType.Delimiter) as IOfficeMathDelimiter;
//Adds a math in the delimiter
officeMath = mathDelimiter.Equation.Add() as IOfficeMath;
//Adds a math text
AddMathText(document, officeMath, "x");
AddMathText(document, math.MathParagraph.Maths.Add(), "=");
//Adds a Subscript equation
IOfficeMathScript mathScript = AddMathScript(math.MathParagraph.Maths.Add(), MathScriptType.Subscript);
//Adds a math text
AddMathText(document, mathScript.Equation, "a");
AddMathText(document, mathScript.Script, "0");
//Adds a math text
AddMathText(document, math.MathParagraph.Maths.Add(), "+");
//Adds a math n-array
IOfficeMathNArray mathNAry = math.MathParagraph.Maths.Add().Functions.Add(MathFunctionType.NArray) as IOfficeMathNArray;
//Unicode value of n-array summation
string sigma = "\u2211";
//Sets the value as the n-array character
mathNAry.NArrayCharacter = sigma;
mathNAry.HasGrow = true;
//Adds a math text
AddMathText(document, mathNAry.Subscript, "n=1");
//Adds a math text
string infinitySymbol = "\u221E";
AddMathText(document, mathNAry.Superscript, infinitySymbol);
//Adds a math delimiter
mathDelimiter = mathNAry.Equation.Functions.Add(MathFunctionType.Delimiter) as IOfficeMathDelimiter;
//Adds an math in the delimiter equation collection
officeMath = mathDelimiter.Equation.Add() as IOfficeMath;
//Adds a math script
mathScript = AddMathScript(officeMath, MathScriptType.Subscript);
//Adds a math text
AddMathText(document, mathScript.Equation, "a");
//Adds a math text
AddMathText(document, mathScript.Script, "n");
//Adds a math function
IOfficeMathFunction mathFunction = officeMath.Functions.Add(MathFunctionType.Function) as IOfficeMathFunction;
//Adds a math text
IOfficeMathRunElement mathParaItem = AddMathText(document, mathFunction.FunctionName, "cos");
mathParaItem.MathFormat.Style = MathStyleType.Regular;
//Adds a math fraction
IOfficeMathFraction mathFraction = mathFunction.Equation.Functions.Add(MathFunctionType.Fraction) as IOfficeMathFraction;
//Adds a math text
//Unicode value of PI
string pi = "\uD835\uDF0B";
string text = "n" + pi + "x";
AddMathText(document, mathFraction.Numerator, text);
AddMathText(document, mathFraction.Denominator, "L");
//Adds a math text
AddMathText(document, officeMath, "+");
//Adds a math script
mathScript = AddMathScript(officeMath, MathScriptType.Subscript);
//Adds a math text
AddMathText(document, mathScript.Equation, "b");
AddMathText(document, mathScript.Script, "n");
//Adds a function
mathFunction = officeMath.Functions.Add(MathFunctionType.Function) as IOfficeMathFunction;
//Adds a math text
mathParaItem = AddMathText(document, mathFunction.FunctionName, "sin");
mathParaItem.MathFormat.Style = MathStyleType.Regular;
//Adds a math fraction element
mathFraction = mathFunction.Equation.Functions.Add(MathFunctionType.Fraction) as IOfficeMathFraction;
//Adds a math text for numerator
AddMathText(document, mathFraction.Numerator, text);
//Adds a math text for denominator
AddMathText(document, mathFraction.Denominator, "L");
}
/// <summary>
/// Adds a math text
/// </summary>
/// <param name="document">Represents a Word document to add math text</param>
/// <param name="officeMath">Represents an office math to add math text</param>
/// <param name="text">Represents the text to set for math item</param>
private IOfficeMathRunElement AddMathText(WordDocument document, IOfficeMath officeMath, string text)
{
//Adds math text
IOfficeMathRunElement officeMathParaItem = officeMath.Functions.Add(MathFunctionType.RunElement) as IOfficeMathRunElement;
officeMathParaItem.Item = new WTextRange(document);
//Set math text value
(officeMathParaItem.Item as WTextRange).Text = text;
return officeMathParaItem;
}
/// <summary>
/// Adds a math Subscript or Superscript equation
/// </summary>
private IOfficeMathScript AddMathScript(IOfficeMath officeMath, MathScriptType mathScriptType)
{
IOfficeMathScript mathScript = officeMath.Functions.Add(MathFunctionType.SubSuperscript) as IOfficeMathScript;
//Sets the script type as Subscript or Superscript
mathScript.ScriptType = mathScriptType;
return mathScript;
}
/// <summary>
/// Adds a accent equation
/// </summary>
/// <param name="document">Represents a Word document</param>
/// <param name="officeMath">Represents a office math to add accent equation</param>
/// <param name="accentCharValue">Represents a accent character</param>
/// <param name="text">Represents a text for accent equation</param>
private void AddMathAccent(WordDocument document, IOfficeMath officeMath, short accentCharValue, string text)
{
IOfficeMathAccent mathAccent = officeMath.Functions.Add(MathFunctionType.Accent) as IOfficeMathAccent;
//Sets the accent character from short value
mathAccent.AccentCharacter = ConvertShortToString(accentCharValue);
//Adds a math text
IOfficeMathRunElement officeMathParaItem = AddMathText(document, mathAccent.Equation, text);
}
/// <summary>
/// Add values in matrix row
/// </summary>
/// <param name="document">Represents a Word document to add matrix</param>
/// <param name="mathMatrixRow">Represents a matrix row to add values</param>
/// <param name="text">Represents a base text value for Subscript and Superscript equation</param>
private void AddMatrixRowValues(WordDocument document, IOfficeMathMatrixRow mathMatrixRow, string text)
{
//Adds arguments for matrix row
IOfficeMath officeMath = mathMatrixRow.Arguments[0];
//Adds a Subscript
IOfficeMathScript mathScript = AddMathScript(officeMath, MathScriptType.Subscript);
//Adds a math text
IOfficeMathRunElement officeMathParaItem = AddMathText(document, mathScript.Equation, text);
//Adds math text
officeMathParaItem = AddMathText(document, mathScript.Script, "x");
//Adds arguments for matrix row
officeMath = mathMatrixRow.Arguments[1];
//Adds a script
mathScript = AddMathScript(officeMath, MathScriptType.Subscript);
//Adds math text
officeMathParaItem = AddMathText(document, mathScript.Equation, text);
//Adds math text
officeMathParaItem = AddMathText(document, mathScript.Script, "y");
//Adds arguments for matrix row
officeMath = mathMatrixRow.Arguments[2];
//Adds a script
mathScript = AddMathScript(officeMath, MathScriptType.Subscript);
//Adds math text
officeMathParaItem = AddMathText(document, mathScript.Equation, text);
//Adds math text
officeMathParaItem = AddMathText(document, mathScript.Script, "z");
}
#endregion
}
}

Просмотреть файл

@ -1,53 +0,0 @@
<View:SampleLayout
x:Class="EssentialDocIO.EncryptAndDecryptDemo"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:EssentialDocIO" xmlns:View="using:Common"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<View:SampleLayout.Sample>
<ContentControl>
<Grid x:Name="EncryptAndDecrypt" Background="{StaticResource ApplicationPageBackgroundThemeBrush}" Padding="10,0,0,0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock x:Name="TextBlock1" Grid.Row="0" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="18"/>
<TextBlock x:Name="TextBlock2" Grid.Row="1" Grid.ColumnSpan="4" TextWrapping="Wrap" Text="This sample demonstrates how to encrypt and decrypt the Word document using Essential DocIO." FontFamily="Segoe UI" FontSize="20" Foreground="#333333"/>
<TextBlock x:Name="TextBlock3" Grid.Row="2" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="18"/>
<TextBlock x:Name="TextBlock4" Grid.Row="3" Grid.ColumnSpan="4" TextWrapping="Wrap" Text="Please click the Generate button to save and view the Word document generated by Essential DocIO." FontFamily="Segoe UI" FontSize="16" Foreground="#333333"/>
<TextBlock x:Name="TextBlock5" Grid.Row="4" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="16"/>
<StackPanel Name="securityOptions" Grid.Row="5" Grid.ColumnSpan="4" Orientation="Vertical" VerticalAlignment="Top">
<RadioButton GroupName="Security" Content="Encrypt Document" FontFamily="Segoe UI" FontSize="16" Foreground="#333333" x:Name="rdEncrypt" Width="200" IsChecked="True"/>
<RadioButton GroupName="Security" Content="Decrypt Document" FontFamily="Segoe UI" FontSize="16" Foreground="#333333" x:Name="rdDecrypt" Width="200"/>
</StackPanel>
<TextBlock x:Name="TextBlock6" Grid.Row="13" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="14"/>
<TextBlock x:Name="TextBlock7" Grid.Row="14" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="14"/>
<Button x:Name="Button1" Grid.Row="15" Grid.ColumnSpan="4" Content="Generate" Click="Button_Click_1" FontFamily="Segoe UI" FontSize="16" Foreground="#FFFFFF" Background="#656868" Height="Auto" Width="Auto" Padding="30,10,30,10" />
<TextBlock x:Name="TextBlock8" Grid.Row="16" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="16"/>
</Grid>
</ContentControl>
</View:SampleLayout.Sample>
</View:SampleLayout>

Просмотреть файл

@ -1,219 +0,0 @@
#region Copyright Syncfusion Inc. 2001-2020.
// Copyright Syncfusion Inc. 2001-2020. All rights reserved.
// Use of this code is subject to the terms of our license.
// A copy of the current license can be obtained at any time by e-mailing
// licensing@syncfusion.com. Any infringement will be prosecuted under
// applicable laws.
#endregion
using Common;
using Syncfusion.DocIO;
using Syncfusion.DocIO.DLS;
using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using Windows.Storage;
using Windows.Storage.Pickers;
using Windows.UI.Popups;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
namespace EssentialDocIO
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class EncryptAndDecryptDemo : SampleLayout
{
public override void Dispose()
{
base.Dispose();
DisposeTextBlock(TextBlock1);
TextBlock1 = null;
DisposeTextBlock(TextBlock2);
TextBlock2 = null;
DisposeTextBlock(TextBlock3);
TextBlock3 = null;
DisposeTextBlock(TextBlock4);
TextBlock4 = null;
DisposeTextBlock(TextBlock5);
TextBlock5 = null;
DisposeTextBlock(TextBlock6);
TextBlock6 = null;
DisposeTextBlock(TextBlock7);
TextBlock7 = null;
DisposeTextBlock(TextBlock8);
TextBlock8 = null;
Button1.Click -= Button_Click_1;
DisposeButton(Button1);
Button1 = null;
DisposeRadioButton(rdEncrypt);
rdEncrypt = null;
DisposeRadioButton(rdDecrypt);
rdDecrypt = null;
securityOptions.ClearValue(StackPanel.OrientationProperty);
securityOptions.ClearValue(StackPanel.VerticalAlignmentProperty);
securityOptions = null;
EncryptAndDecrypt.ClearValue(Grid.BackgroundProperty);
EncryptAndDecrypt.ClearValue(Grid.PaddingProperty);
EncryptAndDecrypt.Children.Clear();
EncryptAndDecrypt.ColumnDefinitions.Clear();
EncryptAndDecrypt.RowDefinitions.Clear();
EncryptAndDecrypt = null;
}
public void DisposeRadioButton(RadioButton radioButton)
{
radioButton.ClearValue(RadioButton.GroupNameProperty);
radioButton.ClearValue(RadioButton.ContentProperty);
radioButton.ClearValue(RadioButton.FontFamilyProperty);
radioButton.ClearValue(RadioButton.FontSizeProperty);
radioButton.ClearValue(RadioButton.ForegroundProperty);
radioButton.ClearValue(RadioButton.WidthProperty);
radioButton.ClearValue(RadioButton.IsCheckedProperty);
}
public void DisposeTextBlock(TextBlock textBlock)
{
textBlock.ClearValue(TextBlock.FontFamilyProperty);
textBlock.ClearValue(TextBlock.FontSizeProperty);
textBlock.ClearValue(TextBlock.TextProperty);
textBlock.ClearValue(TextBlock.TextWrappingProperty);
textBlock.ClearValue(TextBlock.ForegroundProperty);
}
public void DisposeButton(Button button)
{
button.ClearValue(Button.FontFamilyProperty);
button.ClearValue(Button.FontSizeProperty);
button.ClearValue(Button.PaddingProperty);
button.ClearValue(Button.ForegroundProperty);
button.ClearValue(Button.BackgroundProperty);
button.ClearValue(Button.ContentProperty);
button.ClearValue(Button.HeightProperty);
button.ClearValue(Button.WidthProperty);
}
public EncryptAndDecryptDemo()
{
InitializeComponent();
if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons"))
{
EncryptAndDecrypt.Margin = new Thickness(10, 10, 10, 10);
securityOptions.Visibility = Visibility.Collapsed;
TextBlock5.Visibility = Visibility.Collapsed;
TextBlock6.Visibility = Visibility.Collapsed;
TextBlock7.Visibility = Visibility.Collapsed;
TextBlock4.Visibility = Visibility.Collapsed;
}
else
{
securityOptions.Visibility = Visibility.Visible;
TextBlock6.Visibility = Visibility.Visible;
TextBlock5.Visibility = Visibility.Visible;
TextBlock7.Visibility = Visibility.Visible;
}
}
private async void Button_Click_1(object sender, RoutedEventArgs e)
{
Assembly execAssem = typeof(EncryptAndDecryptDemo).GetTypeInfo().Assembly;
WordDocument document = null;
if (rdEncrypt.IsChecked==true)
{
document = new WordDocument();
document.EnsureMinimal();
// Getting last section of the document.
IWSection section = document.LastSection;
// Adding a paragraph to the section.
IWParagraph paragraph = section.AddParagraph();
// Writing text
IWTextRange text = paragraph.AppendText("This document was encrypted with password");
text.CharacterFormat.FontSize = 16f;
text.CharacterFormat.FontName = "Bitstream Vera Serif";
// Encrypt the document by giving password
document.EncryptDocument("syncfusion");
}
else
{
// Open an existing template document with single section.
document = new WordDocument();
Stream inputStream = execAssem.GetManifestResourceStream("Syncfusion.SampleBrowser.UWP.DocIO.DocIO.Assets.Security Settings.docx");
// Open an existing template document.
await document.OpenAsync(inputStream, FormatType.Docx, "syncfusion");
inputStream.Dispose();
// Getting last section of the document.
IWSection section = document.LastSection;
// Adding a paragraph to the section.
IWParagraph paragraph = section.AddParagraph();
// Writing text
IWTextRange text = paragraph.AppendText("\nDemo For Document Decryption with Essential DocIO");
text.CharacterFormat.FontSize = 16f;
text.CharacterFormat.FontName = "Bitstream Vera Serif";
text = paragraph.AppendText("\nThis document is Decrypted");
text.CharacterFormat.FontSize = 16f;
text.CharacterFormat.FontName = "Bitstream Vera Serif";
}
Save(document);
}
private async void Save(WordDocument document)
{
StorageFile stgFile;
if (!(Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons")))
{
FileSavePicker savePicker = new FileSavePicker();
savePicker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary;
// File types the user can save the file as
savePicker.FileTypeChoices.Add("Word Document", new List<string>() { ".docx" });
// Default file name if the user does not type one in or select a file to replace
savePicker.SuggestedFileName = "Encrypt and Decrypt";
stgFile = await savePicker.PickSaveFileAsync();
}
else
{
StorageFolder local = Windows.Storage.ApplicationData.Current.LocalFolder;
stgFile = await local.CreateFileAsync("WordDocument.docx", CreationCollisionOption.ReplaceExisting);
}
if (stgFile != null)
{
MemoryStream stream = new MemoryStream();
await document.SaveAsync(stream, FormatType.Docx);
document.Close();
stream.Position = 0;
Windows.Storage.Streams.IRandomAccessStream fileStream = await stgFile.OpenAsync(FileAccessMode.ReadWrite);
Stream st = fileStream.AsStreamForWrite();
st.SetLength(0);
st.Write((stream as MemoryStream).ToArray(), 0, (int)stream.Length);
st.Flush();
st.Dispose();
fileStream.Dispose();
//Save as Docx Format
MessageDialog msgDialog = new MessageDialog("Do you want to view the Document?", "File has been created successfully.");
UICommand yesCmd = new UICommand("Yes");
msgDialog.Commands.Add(yesCmd);
UICommand noCmd = new UICommand("No");
msgDialog.Commands.Add(noCmd);
IUICommand cmd = await msgDialog.ShowAsync();
if (cmd == yesCmd)
{
// Launch the retrieved file
bool success = await Windows.System.Launcher.LaunchFileAsync(stgFile);
}
}
}
}
}

Просмотреть файл

@ -1,72 +0,0 @@
<View:SampleLayout
x:Class="EssentialDocIO.FindAndReplaceDemo"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:EssentialDocIO" xmlns:View="using:Common"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<View:SampleLayout.Sample>
<ContentControl>
<Grid x:Name="FindAndReplace" Background="{StaticResource ApplicationPageBackgroundThemeBrush}" Padding="10,0,0,0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock x:Name="TextBlock1" Grid.Row="0" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="18"/>
<TextBlock x:Name="TextBlock2" Grid.Row="1" Grid.ColumnSpan="4" TextWrapping="Wrap" Text="This sample demonstrates the find and replace functionality in Word document using Essential DocIO." FontFamily="Segoe UI" FontSize="20" Foreground="#333333"/>
<TextBlock x:Name="TextBlock3" Grid.Row="2" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="18"/>
<TextBlock x:Name="TextBlock4" Grid.Row="3" TextWrapping="Wrap" Text="Look in :" FontFamily="Segoe UI" FontSize="16" Foreground="#333333"/>
<TextBox x:Name="InputFile1" Grid.Row="3" Grid.Column="1" FontFamily="Segoe UI" FontSize="16" Foreground="#333333"/>
<Button x:Name="Button1" Grid.Row="3" Grid.Column="2" Content=". . ." Click="Button_Click_3" FontFamily="Segoe UI" FontSize="16" Foreground="#FFFFFF" Background="#656868" Padding="15,7,15,5"/>
<TextBlock x:Name="TextBlock5" Grid.Row="4" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="16"/>
<TextBlock x:Name="TextBlock6" Grid.Row="5" TextWrapping="Wrap" Text="Find what :" FontFamily="Segoe UI" FontSize="16" Foreground="#333333"/>
<TextBox x:Name="FindTextBox" Grid.Row="5" Grid.Column="1" FontFamily="Segoe UI" FontSize="16" Foreground="#333333"/>
<TextBlock x:Name="TextBlock7" Grid.Row="6" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="16"/>
<TextBlock x:Name="TextBlock8" Grid.Row="7" FontFamily="Segoe UI" FontSize="16" TextWrapping="Wrap" Text="Replace with :" Foreground="#333333"/>
<TextBox x:Name="ReplaceTextBox" Grid.Row="7" Grid.Column="1" FontFamily="Segoe UI" FontSize="16" Foreground="#333333"/>
<TextBlock x:Name="TextBlock9" Grid.Row="8" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="16"/>
<TextBlock x:Name="TextBlock10" Grid.Row="9" TextWrapping="Wrap" Text="Search Options : " FontFamily="Segoe UI" FontSize="16" Foreground="#333333"/>
<CheckBox x:Name="chkBoxMatchCase" Grid.Row="9" Grid.Column="1" Content="Match Case" FontFamily="Segoe UI" FontSize="16" Foreground="#333333"/>
<CheckBox x:Name="chkBoxWholeWord" Grid.Row="9" Grid.Column="2" Content="Whole Word" FontFamily="Segoe UI" FontSize="16" Foreground="#333333"/>
<TextBlock x:Name="TextBlock11" Grid.Row="10" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="16"/>
<TextBlock x:Name="TextBlock12" Grid.Row="11" Grid.ColumnSpan="4" TextWrapping="Wrap" Text="Please click the Generate button to save and view the Word document generated by Essential DocIO." FontFamily="Segoe UI" FontSize="16" Foreground="#333333"/>
<TextBlock x:Name="TextBlock13" Grid.Row="12" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="16"/>
<TextBlock x:Name="TextBlock14" Grid.Row="13" TextWrapping="Wrap" Text="Save As" FontFamily="Segoe UI" FontSize="16" Foreground="#333333"/>
<TextBlock x:Name="TextBlock15" Grid.Row="14" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="14"/>
<StackPanel Name="stackPnlOptions" Grid.Row="15" Grid.ColumnSpan="4" Orientation="Horizontal" HorizontalAlignment="Left">
<RadioButton GroupName="Save As" Content="DOC" FontFamily="Segoe UI" FontSize="16" Foreground="#333333" x:Name="rdDoc" Width="150" />
<RadioButton GroupName="Save As" Content="DOCX" FontFamily="Segoe UI" FontSize="16" Foreground="#333333" x:Name="rdDocx" Width="150" IsChecked="True"/>
</StackPanel>
<TextBlock x:Name="TextBlock16" Grid.Row="16" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="16"/>
<TextBlock x:Name="TextBlock17" Grid.Row="17" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="16"/>
<Button Grid.Row="18" Grid.ColumnSpan="4" x:Name="generateButton" IsEnabled="False" Content="Generate" Click="Button_Click_1" FontFamily="Segoe UI" FontSize="16" Foreground="#FFFFFF" Background="#656868" Padding="30,10,30,10"/>
<TextBlock x:Name="TextBlock18" Grid.Row="19" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="16"/>
</Grid>
</ContentControl>
</View:SampleLayout.Sample>
</View:SampleLayout>

Просмотреть файл

@ -1,237 +0,0 @@
#region Copyright Syncfusion Inc. 2001-2024.
// Copyright Syncfusion Inc. 2001-2024. All rights reserved.
// Use of this code is subject to the terms of our license.
// A copy of the current license can be obtained at any time by e-mailing
// licensing@syncfusion.com. Any infringement will be prosecuted under
// applicable laws.
#endregion
using Common;
using Syncfusion.DocIO;
using Syncfusion.DocIO.DLS;
using System;
using System.Collections.Generic;
using Windows.Storage;
using Windows.Storage.Pickers;
using Windows.UI.Popups;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
namespace EssentialDocIO
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class FindAndReplaceDemo : SampleLayout
{
public override void Dispose()
{
base.Dispose();
DisposeTextBlock(TextBlock1);
TextBlock1 = null;
DisposeTextBlock(TextBlock2);
TextBlock2 = null;
DisposeTextBlock(TextBlock3);
TextBlock3 = null;
DisposeTextBlock(TextBlock4);
TextBlock4 = null;
DisposeTextBlock(TextBlock5);
TextBlock5 = null;
DisposeTextBlock(TextBlock6);
TextBlock6 = null;
DisposeTextBlock(TextBlock7);
TextBlock7 = null;
DisposeTextBlock(TextBlock8);
TextBlock8 = null;
DisposeTextBlock(TextBlock9);
TextBlock9 = null;
DisposeTextBlock(TextBlock10);
TextBlock10 = null;
DisposeTextBlock(TextBlock11);
TextBlock11 = null;
DisposeTextBlock(TextBlock12);
TextBlock12 = null;
DisposeTextBlock(TextBlock13);
TextBlock13 = null;
DisposeTextBlock(TextBlock14);
TextBlock14 = null;
DisposeTextBlock(TextBlock15);
TextBlock15 = null;
DisposeTextBlock(TextBlock16);
TextBlock16 = null;
DisposeTextBlock(TextBlock17);
TextBlock17 = null;
DisposeTextBlock(TextBlock18);
TextBlock18 = null;
DisposeTextBox(InputFile1);
InputFile1 = null;
DisposeTextBox(FindTextBox);
FindTextBox = null;
DisposeTextBox(ReplaceTextBox);
ReplaceTextBox = null;
DisposeCheckBox(chkBoxMatchCase);
chkBoxMatchCase = null;
DisposeCheckBox(chkBoxWholeWord);
chkBoxWholeWord = null;
Button1.Click -= Button_Click_3;
DisposeButton(Button1);
Button1 = null;
generateButton.Click -= Button_Click_1;
DisposeButton(generateButton);
generateButton = null;
DisposeRadioButton(rdDoc);
rdDoc = null;
DisposeRadioButton(rdDocx);
rdDocx = null;
stackPnlOptions.ClearValue(StackPanel.OrientationProperty);
stackPnlOptions.ClearValue(StackPanel.HorizontalAlignmentProperty);
stackPnlOptions = null;
FindAndReplace.ClearValue(Grid.BackgroundProperty);
FindAndReplace.ClearValue(Grid.PaddingProperty);
FindAndReplace.Children.Clear();
FindAndReplace.ColumnDefinitions.Clear();
FindAndReplace.RowDefinitions.Clear();
FindAndReplace = null;
}
public void DisposeCheckBox(CheckBox checkBox)
{
checkBox.ClearValue(CheckBox.FontFamilyProperty);
checkBox.ClearValue(CheckBox.FontSizeProperty);
checkBox.ClearValue(CheckBox.FontSizeProperty);
}
public void DisposeTextBox(TextBox textBox)
{
textBox.ClearValue(TextBox.FontFamilyProperty);
textBox.ClearValue(TextBox.FontSizeProperty);
textBox.ClearValue(TextBox.ForegroundProperty);
}
public void DisposeRadioButton(RadioButton radioButton)
{
radioButton.ClearValue(RadioButton.GroupNameProperty);
radioButton.ClearValue(RadioButton.ContentProperty);
radioButton.ClearValue(RadioButton.FontFamilyProperty);
radioButton.ClearValue(RadioButton.FontSizeProperty);
radioButton.ClearValue(RadioButton.ForegroundProperty);
radioButton.ClearValue(RadioButton.WidthProperty);
radioButton.ClearValue(RadioButton.IsCheckedProperty);
}
public void DisposeTextBlock(TextBlock textBlock)
{
textBlock.ClearValue(TextBlock.FontFamilyProperty);
textBlock.ClearValue(TextBlock.FontSizeProperty);
textBlock.ClearValue(TextBlock.TextProperty);
textBlock.ClearValue(TextBlock.TextWrappingProperty);
textBlock.ClearValue(TextBlock.ForegroundProperty);
}
public void DisposeButton(Button button)
{
button.ClearValue(Button.FontFamilyProperty);
button.ClearValue(Button.FontSizeProperty);
button.ClearValue(Button.PaddingProperty);
button.ClearValue(Button.ForegroundProperty);
button.ClearValue(Button.BackgroundProperty);
button.ClearValue(Button.ContentProperty);
button.ClearValue(Button.HeightProperty);
button.ClearValue(Button.WidthProperty);
button.ClearValue(Button.IsEnabledProperty);
}
public FindAndReplaceDemo()
{
InitializeComponent();
}
StorageFile file;
private async void Button_Click_1(object sender, RoutedEventArgs e)
{
WordDocument document = new WordDocument();
//Open an existing word document.
await document.OpenAsync(file);
if (FindTextBox.Text.Trim() == string.Empty || ReplaceTextBox.Text.Trim() == string.Empty)
{
MessageDialog msgDialog = new MessageDialog("Please fill the find and replacement text in appropriate textboxes...");
UICommand okCmd = new UICommand("Ok");
msgDialog.Commands.Add(okCmd);
IUICommand cmd = await msgDialog.ShowAsync();
}
else
{
document.Replace(FindTextBox.Text, ReplaceTextBox.Text, chkBoxMatchCase.IsChecked.Value, chkBoxWholeWord.IsChecked.Value);
StorageFile stgFile = null;
if (!(Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons")))
{
FileSavePicker savePicker = new FileSavePicker();
savePicker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary;
savePicker.SuggestedFileName = "Sample";
if (rdDoc.IsChecked.Value)
{
savePicker.FileTypeChoices.Add("Word Document", new List<string>() { ".doc" });
stgFile = await savePicker.PickSaveFileAsync();
if (stgFile != null)
await document.SaveAsync(stgFile, FormatType.Doc);
}
else
{
savePicker.FileTypeChoices.Add("Word Document", new List<string>() { ".docx" });
stgFile = await savePicker.PickSaveFileAsync();
if (stgFile != null)
{
await document.SaveAsync(stgFile, FormatType.Docx);
}
}
}
else
{
StorageFolder local = Windows.Storage.ApplicationData.Current.LocalFolder;
stgFile = await local.CreateFileAsync("WordDocument.docx", CreationCollisionOption.ReplaceExisting);
if (stgFile != null)
{
await document.SaveAsync(stgFile, FormatType.Docx);
}
}
if (stgFile != null)
{
MessageDialog msgDialog = new MessageDialog("Do you want to view the Document?", "File has been created successfully.");
UICommand yesCmd = new UICommand("Yes");
msgDialog.Commands.Add(yesCmd);
UICommand noCmd = new UICommand("No");
msgDialog.Commands.Add(noCmd);
IUICommand cmd = await msgDialog.ShowAsync();
if (cmd == yesCmd)
{
// Launch the retrieved file
bool success = await Windows.System.Launcher.LaunchFileAsync(stgFile);
}
}
}
}
private async void Button_Click_3(object sender, RoutedEventArgs e)
{
FileOpenPicker openPicker = new FileOpenPicker();
openPicker.ViewMode = PickerViewMode.List;
openPicker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary;
openPicker.FileTypeFilter.Add(".doc");
openPicker.FileTypeFilter.Add(".docx");
StorageFile tempFile = await openPicker.PickSingleFileAsync();
if (tempFile != null)
file = tempFile;
if (file == null)
generateButton.IsEnabled = false;
else
{
// Application now has read/write access to the picked file
InputFile1.Text = file.Name;
generateButton.IsEnabled = true;
}
}
}
}

Просмотреть файл

@ -1,43 +0,0 @@
<View:SampleLayout
x:Class="EssentialDocIO.FormFillingAndProtectionDemo"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:EssentialDocIO" xmlns:View="using:Common"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<View:SampleLayout.Sample>
<ContentControl>
<Grid x:Name="FormFillingAndProtection" Background="{StaticResource ApplicationPageBackgroundThemeBrush}" Padding="10,0,0,0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock x:Name="TextBlock1" Grid.Row="0" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="18"/>
<TextBlock x:Name="TextBlock2" Grid.Row="1" Grid.ColumnSpan="4" TextWrapping="Wrap" Text="This sample illustrates filling form and protecting the content controls in an existing Word document using Essential DocIO." FontFamily="Segoe UI" FontSize="20" Foreground="#333333"/>
<TextBlock x:Name="TextBlock3" Grid.Row="2" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="18"/>
<TextBlock x:Name="TextBlock4" Grid.Row="3" Grid.ColumnSpan="4" TextWrapping="Wrap" Text="Click the button to view the generated Word document. Please note that Microsoft Word Viewer or Microsoft Word is required to view the resultant Word document." FontFamily="Segoe UI" FontSize="16" Foreground="#333333"/>
<TextBlock x:Name="TextBlock5" Grid.Row="4" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="16"/>
<TextBlock x:Name="TextBlock6" Grid.Row="6" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="14"/>
<Button x:Name="Button1" Grid.Row="10" Grid.ColumnSpan="4" Content="Generate" Click="Button_Click_1" FontFamily="Segoe UI" FontSize="16" Foreground="#FFFFFF" Background="#656868" Padding="30,10,30,10"/>
<TextBlock x:Name="TextBlock7" Grid.Row="11" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="16"/>
</Grid>
</ContentControl>
</View:SampleLayout.Sample>
</View:SampleLayout>

Просмотреть файл

@ -1,318 +0,0 @@
#region Copyright Syncfusion Inc. 2001-2024.
// Copyright Syncfusion Inc. 2001-2024. All rights reserved.
// Use of this code is subject to the terms of our license.
// A copy of the current license can be obtained at any time by e-mailing
// licensing@syncfusion.com. Any infringement will be prosecuted under
// applicable laws.
#endregion
using Common;
using Syncfusion.DocIO;
using Syncfusion.DocIO.DLS;
using System;
using System.Collections.Generic;
using System.IO;
using Windows.Storage;
using Windows.Storage.Pickers;
using Windows.UI.Popups;
using Windows.UI.Xaml;
using System.Reflection;
using Windows.UI.Xaml.Controls;
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
namespace EssentialDocIO
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class FormFillingAndProtectionDemo : SampleLayout
{
#region Fields
// Gets current executing assembly.
Assembly execAssm = typeof(FormFillingAndProtectionDemo).GetTypeInfo().Assembly;
#endregion
/// <summary>
/// Constructor for FormFillingAndProtectionDemo.
/// </summary>
public FormFillingAndProtectionDemo()
{
InitializeComponent();
if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons"))
{
TextBlock4.Visibility = Visibility.Collapsed;
}
}
/// <summary>
/// Disposes the objects such as text blocks, buttons, and etc., of FormFillingAndProtection.
/// </summary>
public override void Dispose()
{
base.Dispose();
DisposeTextBlock(TextBlock1);
TextBlock1 = null;
DisposeTextBlock(TextBlock2);
TextBlock2 = null;
DisposeTextBlock(TextBlock3);
TextBlock3 = null;
DisposeTextBlock(TextBlock4);
TextBlock4 = null;
DisposeTextBlock(TextBlock5);
TextBlock5 = null;
DisposeTextBlock(TextBlock6);
TextBlock6 = null;
DisposeTextBlock(TextBlock7);
TextBlock7 = null;
Button1.Click -= Button_Click_1;
DisposeButton(Button1);
Button1 = null;
FormFillingAndProtection.ClearValue(Grid.BackgroundProperty);
FormFillingAndProtection.ClearValue(Grid.PaddingProperty);
FormFillingAndProtection.Children.Clear();
FormFillingAndProtection.ColumnDefinitions.Clear();
FormFillingAndProtection.RowDefinitions.Clear();
FormFillingAndProtection = null;
}
/// <summary>
/// Disposes the objects from text block.
/// </summary>
/// <param name="textBlock">Text Block</param>
public void DisposeTextBlock(TextBlock textBlock)
{
textBlock.ClearValue(TextBlock.FontFamilyProperty);
textBlock.ClearValue(TextBlock.FontSizeProperty);
textBlock.ClearValue(TextBlock.TextProperty);
textBlock.ClearValue(TextBlock.TextWrappingProperty);
textBlock.ClearValue(TextBlock.ForegroundProperty);
}
/// <summary>
/// Disposes the object from button.
/// </summary>
/// <param name="button">Button</param>
public void DisposeButton(Button button)
{
button.ClearValue(FontFamilyProperty);
button.ClearValue(Button.FontSizeProperty);
button.ClearValue(Button.PaddingProperty);
button.ClearValue(Button.ForegroundProperty);
button.ClearValue(Button.BackgroundProperty);
button.ClearValue(Button.ContentProperty);
}
/// <summary>
/// Button click event for FormFillingAndProtection.
/// </summary>
/// <param name="sender">Sender</param>
/// <param name="e">Event args</param>
private void Button_Click_1(object sender, RoutedEventArgs e)
{
// Load Template document stream.
Stream inputStream = execAssm.GetManifestResourceStream("Syncfusion.SampleBrowser.UWP.DocIO.DocIO.Assets.ContentControlTemplate.docx");
// Creates an empty Word document instance.
WordDocument document = new WordDocument();
// Opens template document.
document.Open(inputStream, FormatType.Docx);
IWTextRange textRange;
//Gets table from the template document.
IWTable table = document.LastSection.Tables[0];
WTableRow row = table.Rows[1];
#region Inserting content controls
#region Calendar content control
IWParagraph cellPara = row.Cells[0].Paragraphs[0];
//Accesses the date picker content control.
IInlineContentControl inlineControl = (cellPara.ChildEntities[2] as IInlineContentControl);
textRange = inlineControl.ParagraphItems[0] as WTextRange;
//Sets today's date to display.
textRange.Text = DateTime.Now.ToString("d");
textRange.CharacterFormat.FontSize = 14;
//Protects the content control.
inlineControl.ContentControlProperties.LockContents = true;
#endregion
#region Plain text content controls
table = document.LastSection.Tables[1];
row = table.Rows[0];
cellPara = row.Cells[0].LastParagraph;
//Accesses the plain text content control.
inlineControl = (cellPara.ChildEntities[1] as IInlineContentControl);
//Protects the content control.
inlineControl.ContentControlProperties.LockContents = true;
textRange = inlineControl.ParagraphItems[0] as WTextRange;
//Sets text in plain text content control.
textRange.Text = "Northwind Analytics";
textRange.CharacterFormat.FontSize = 14;
cellPara = row.Cells[1].LastParagraph;
//Accesses the plain text content control.
inlineControl = (cellPara.ChildEntities[1] as IInlineContentControl);
//Protects the content control.
inlineControl.ContentControlProperties.LockContents = true;
textRange = inlineControl.ParagraphItems[0] as WTextRange;
//Sets text in plain text content control.
textRange.Text = "Northwind";
textRange.CharacterFormat.FontSize = 14;
row = table.Rows[1];
cellPara = row.Cells[0].LastParagraph;
//Accesses the plain text content control.
inlineControl = (cellPara.ChildEntities[1] as IInlineContentControl);
//Protects the content control.
inlineControl.ContentControlProperties.LockContents = true;
//Sets text in plain text content control.
textRange = inlineControl.ParagraphItems[0] as WTextRange;
textRange.Text = "10";
textRange.CharacterFormat.FontSize = 14;
cellPara = row.Cells[1].LastParagraph;
//Accesses the plain text content control.
inlineControl = (cellPara.ChildEntities[1] as IInlineContentControl);
//Protects the content control.
inlineControl.ContentControlProperties.LockContents = true;
//Sets text in plain text content control.
textRange = inlineControl.ParagraphItems[0] as WTextRange;
textRange.Text = "Nancy Davolio";
textRange.CharacterFormat.FontSize = 14;
#endregion
#region CheckBox Content control
row = table.Rows[2];
cellPara = row.Cells[0].LastParagraph;
//Inserts checkbox content control.
inlineControl = cellPara.AppendInlineContentControl(ContentControlType.CheckBox);
inlineControl.ContentControlProperties.LockContents = true;
//Sets checkbox as checked state.
inlineControl.ContentControlProperties.IsChecked = true;
textRange = cellPara.AppendText("C#, ");
textRange.CharacterFormat.FontSize = 14;
//Inserts checkbox content control.
inlineControl = cellPara.AppendInlineContentControl(ContentControlType.CheckBox);
inlineControl.ContentControlProperties.LockContents = true;
//Sets checkbox as checked state.
inlineControl.ContentControlProperties.IsChecked = true;
textRange = cellPara.AppendText("VB");
textRange.CharacterFormat.FontSize = 14;
#endregion
#region Drop down list content control
cellPara = row.Cells[1].LastParagraph;
//Accesses the dropdown list content control.
inlineControl = (cellPara.ChildEntities[1] as IInlineContentControl);
inlineControl.ContentControlProperties.LockContents = true;
//Sets default option to display.
textRange = inlineControl.ParagraphItems[0] as WTextRange;
textRange.Text = "ASP.NET";
textRange.CharacterFormat.FontSize = 14;
inlineControl.ParagraphItems.Add(textRange);
//Adds items to the dropdown list.
ContentControlListItem item;
item = new ContentControlListItem();
item.DisplayText = "ASP.NET MVC";
item.Value = "2";
inlineControl.ContentControlProperties.ContentControlListItems.Add(item);
item = new ContentControlListItem();
item.DisplayText = "Windows Forms";
item.Value = "3";
inlineControl.ContentControlProperties.ContentControlListItems.Add(item);
item = new ContentControlListItem();
item.DisplayText = "WPF";
item.Value = "4";
inlineControl.ContentControlProperties.ContentControlListItems.Add(item);
item = new ContentControlListItem();
item.DisplayText = "Xamarin";
item.Value = "5";
inlineControl.ContentControlProperties.ContentControlListItems.Add(item);
#endregion
#region Calendar content control
row = table.Rows[3];
cellPara = row.Cells[0].LastParagraph;
//Accesses the date picker content control.
inlineControl = (cellPara.ChildEntities[1] as IInlineContentControl);
inlineControl.ContentControlProperties.LockContents = true;
//Sets default date to display.
textRange = inlineControl.ParagraphItems[0] as WTextRange;
textRange.Text = DateTime.Now.AddDays(-5).ToString("d");
textRange.CharacterFormat.FontSize = 14;
cellPara = row.Cells[1].LastParagraph;
//Inserts date picker content control.
inlineControl = (cellPara.ChildEntities[1] as IInlineContentControl);
inlineControl.ContentControlProperties.LockContents = true;
//Sets default date to display.
textRange = inlineControl.ParagraphItems[0] as WTextRange;
textRange.Text = DateTime.Now.AddDays(10).ToString("d");
textRange.CharacterFormat.FontSize = 14;
#endregion
#endregion
#region Block content control
//Accesses the block content control.
BlockContentControl blockContentControl = ((document.ChildEntities[0] as WSection).Body.ChildEntities[2] as BlockContentControl);
//Protects the block content control
blockContentControl.ContentControlProperties.LockContents = true;
#endregion
Save(document);
}
/// <summary>
/// Saves Word document.
/// </summary>
/// <param name="document">Word document</param>
private async void Save(WordDocument document)
{
StorageFile stgFile;
if (!(Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons")))
{
FileSavePicker savePicker = new FileSavePicker();
savePicker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary;
// Dropdown of file types the user can save the file as
savePicker.FileTypeChoices.Add("Word Document", new List<string>() { ".docx" });
// Default file name if the user does not type one in or select a file to replace
savePicker.SuggestedFileName = "Sample";
stgFile = await savePicker.PickSaveFileAsync();
}
else
{
StorageFolder local = Windows.Storage.ApplicationData.Current.LocalFolder;
stgFile = await local.CreateFileAsync("WordDocument.docx", CreationCollisionOption.ReplaceExisting);
}
if (stgFile != null)
{
MemoryStream stream = new MemoryStream();
await document.SaveAsync(stream, FormatType.Docx);
document.Close();
stream.Position = 0;
Windows.Storage.Streams.IRandomAccessStream fileStream = await stgFile.OpenAsync(FileAccessMode.ReadWrite);
Stream st = fileStream.AsStreamForWrite();
st.SetLength(0);
st.Write((stream as MemoryStream).ToArray(), 0, (int)stream.Length);
st.Flush();
st.Dispose();
fileStream.Dispose();
MessageDialog msgDialog = new MessageDialog("Do you want to view the Document?", "File has been created successfully.");
UICommand yesCmd = new UICommand("Yes");
msgDialog.Commands.Add(yesCmd);
UICommand noCmd = new UICommand("No");
msgDialog.Commands.Add(noCmd);
IUICommand cmd = await msgDialog.ShowAsync();
if (cmd == yesCmd)
{
// Launch the retrieved file
bool success = await Windows.System.Launcher.LaunchFileAsync(stgFile);
}
}
}
}
}

Просмотреть файл

@ -1,53 +0,0 @@
<View:SampleLayout
x:Class="EssentialDocIO.GettingStartedDemo"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:EssentialDocIO" xmlns:View="using:Common"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<View:SampleLayout.Sample>
<ContentControl>
<Grid x:Name="GettingStarted" Background="{StaticResource ApplicationPageBackgroundThemeBrush}" Padding="10,0,0,0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock x:Name="TextBlock1" Grid.Row="0" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="18"/>
<TextBlock x:Name="WinRTText1" Grid.Row="1" Grid.ColumnSpan="4" TextWrapping="Wrap" Text="This sample demonstrates to create Word document using Essential DocIO." FontFamily="Segoe UI" FontSize="20" Foreground="#333333"/>
<TextBlock x:Name="TextBlock2" Grid.Row="2" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="18"/>
<TextBlock x:Name="WinRTText2" Grid.Row="3" Grid.ColumnSpan="4" TextWrapping="Wrap" Text="Please click the Generate button to save and view the Word document generated by Essential DocIO." FontFamily="Segoe UI" FontSize="16" Foreground="#333333"/>
<TextBlock x:Name="text1" Grid.Row="4" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="16"/>
<TextBlock Grid.Row="5" TextWrapping="Wrap" Text="Save As" FontFamily="Segoe UI" FontSize="16" x:Name="saveas" Foreground="#333333"/>
<TextBlock x:Name="text2" Grid.Row="6" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="14"/>
<StackPanel Name="stackPnlOptions" Grid.Row="9" Grid.ColumnSpan="4" Orientation="Horizontal" HorizontalAlignment="Left">
<RadioButton GroupName="Save As" Content="DOC" FontFamily="Segoe UI" FontSize="16" Foreground="#333333" x:Name="rdDoc" Width="150" />
<RadioButton GroupName="Save As" Content="DOCX" FontFamily="Segoe UI" FontSize="16" Foreground="#333333" x:Name="rdDocx" Width="150" IsChecked="True"/>
</StackPanel>
<TextBlock x:Name="TextBlock4" Grid.Row="10" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="16"/>
<TextBlock x:Name="TextBlock5" Grid.Row="11" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="16"/>
<Button x:Name="Button1" Grid.Row="12" Grid.ColumnSpan="4" Content="Generate" Click="Button_Click_1" FontFamily="Segoe UI" FontSize="16" Foreground="#FFFFFF" Background="#656868" Height="Auto" Width="Auto" Padding="30,10,30,10" />
<TextBlock x:Name="TextBlock6" Grid.Row="13" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="16"/>
</Grid>
</ContentControl>
</View:SampleLayout.Sample>
</View:SampleLayout>

Просмотреть файл

@ -1,413 +0,0 @@
#region Copyright Syncfusion Inc. 2001-2024.
// Copyright Syncfusion Inc. 2001-2024. All rights reserved.
// Use of this code is subject to the terms of our license.
// A copy of the current license can be obtained at any time by e-mailing
// licensing@syncfusion.com. Any infringement will be prosecuted under
// applicable laws.
#endregion
using Common;
using Syncfusion.DocIO;
using Syncfusion.DocIO.DLS;
using System;
using System.Collections.Generic;
using System.IO;
using Windows.Storage;
using Windows.Storage.Pickers;
using Windows.UI.Popups;
using Windows.UI.Xaml;
using System.Reflection;
using Windows.UI.Xaml.Controls;
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
namespace EssentialDocIO
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class GettingStartedDemo : SampleLayout
{
#region Fields
Assembly execAssm = typeof(GettingStartedDemo).GetTypeInfo().Assembly;
#endregion
public GettingStartedDemo()
{
this.InitializeComponent();
if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons"))
{
GettingStarted.Margin = new Thickness(10, 10, 10, 10);
stackPnlOptions.Visibility = Visibility.Collapsed;
saveas.Visibility = Visibility.Collapsed;
text1.Visibility = Visibility.Collapsed;
text2.Visibility = Visibility.Collapsed;
WinRTText2.Visibility = Visibility.Collapsed;
}
else
{
stackPnlOptions.Visibility = Visibility.Visible;
saveas.Visibility = Visibility.Visible;
text1.Visibility = Visibility.Visible;
text2.Visibility = Visibility.Visible;
}
}
public override void Dispose()
{
base.Dispose();
DisposeTextBlock(TextBlock1);
TextBlock1 = null;
DisposeTextBlock(TextBlock2);
TextBlock2 = null;
DisposeTextBlock(saveas);
saveas = null;
DisposeTextBlock(TextBlock4);
TextBlock4 = null;
DisposeTextBlock(TextBlock5);
TextBlock5 = null;
DisposeTextBlock(TextBlock6);
TextBlock6 = null;
DisposeTextBlock(WinRTText1);
WinRTText1 = null;
DisposeTextBlock(WinRTText2);
WinRTText2 = null;
DisposeTextBlock(text1);
text1 = null;
DisposeTextBlock(text2);
text2 = null;
Button1.Click -= Button_Click_1;
DisposeButton(Button1);
Button1 = null;
DisposeRadioButton(rdDoc);
rdDoc = null;
DisposeRadioButton(rdDocx);
rdDocx = null;
stackPnlOptions.ClearValue(StackPanel.OrientationProperty);
stackPnlOptions.ClearValue(StackPanel.HorizontalAlignmentProperty);
stackPnlOptions = null;
GettingStarted.ClearValue(Grid.BackgroundProperty);
GettingStarted.ClearValue(Grid.PaddingProperty);
GettingStarted.Children.Clear();
GettingStarted.ColumnDefinitions.Clear();
GettingStarted.RowDefinitions.Clear();
GettingStarted = null;
}
public void DisposeRadioButton(RadioButton radioButton)
{
radioButton.ClearValue(RadioButton.GroupNameProperty);
radioButton.ClearValue(RadioButton.ContentProperty);
radioButton.ClearValue(RadioButton.FontFamilyProperty);
radioButton.ClearValue(RadioButton.FontSizeProperty);
radioButton.ClearValue(RadioButton.ForegroundProperty);
radioButton.ClearValue(RadioButton.WidthProperty);
radioButton.ClearValue(RadioButton.IsCheckedProperty);
}
public void DisposeTextBlock(TextBlock textBlock)
{
textBlock.ClearValue(TextBlock.FontFamilyProperty);
textBlock.ClearValue(TextBlock.FontSizeProperty);
textBlock.ClearValue(TextBlock.TextProperty);
textBlock.ClearValue(TextBlock.TextWrappingProperty);
textBlock.ClearValue(TextBlock.ForegroundProperty);
}
public void DisposeButton(Button button)
{
button.ClearValue(Button.FontFamilyProperty);
button.ClearValue(Button.FontSizeProperty);
button.ClearValue(Button.PaddingProperty);
button.ClearValue(Button.ForegroundProperty);
button.ClearValue(Button.BackgroundProperty);
button.ClearValue(Button.ContentProperty);
button.ClearValue(Button.HeightProperty);
button.ClearValue(Button.WidthProperty);
}
private void Button_Click_1(object sender, RoutedEventArgs e)
{
// Creating a new document.
WordDocument document = new WordDocument();
//Adding a new section to the document.
WSection section = document.AddSection() as WSection;
//Set Margin of the section
section.PageSetup.Margins.All = 72;
//Set page size of the section
section.PageSetup.PageSize.Width = 612;
section.PageSetup.PageSize.Height = 792;
//Create Paragraph styles
WParagraphStyle style = document.AddParagraphStyle("Normal") as WParagraphStyle;
style.CharacterFormat.FontName = "Calibri";
style.CharacterFormat.FontSize = 11f;
style.ParagraphFormat.BeforeSpacing = 0;
style.ParagraphFormat.AfterSpacing = 8;
style.ParagraphFormat.LineSpacing = 13.8f;
style = document.AddParagraphStyle("Heading 1") as WParagraphStyle;
style.ApplyBaseStyle("Normal");
style.CharacterFormat.FontName = "Calibri Light";
style.CharacterFormat.FontSize = 16f;
style.CharacterFormat.TextColor = Color.FromArgb(46, 116, 181);
style.ParagraphFormat.BeforeSpacing = 12;
style.ParagraphFormat.AfterSpacing = 0;
style.ParagraphFormat.Keep = true;
style.ParagraphFormat.KeepFollow = true;
style.ParagraphFormat.OutlineLevel = OutlineLevel.Level1;
IWParagraph paragraph = section.HeadersFooters.Header.AddParagraph();
Stream imageStream = execAssm.GetManifestResourceStream("Syncfusion.SampleBrowser.UWP.DocIO.DocIO.Assets.AdventureCycle.jpg");
//Appends picture to the paragraph.
WPicture picture = paragraph.AppendPicture(imageStream) as WPicture;
picture.TextWrappingStyle = TextWrappingStyle.InFrontOfText;
picture.VerticalOrigin = VerticalOrigin.Margin;
picture.VerticalPosition = -45;
picture.HorizontalOrigin = HorizontalOrigin.Column;
picture.HorizontalPosition = 263.5f;
picture.WidthScale = 20;
picture.HeightScale = 15;
paragraph.ApplyStyle("Normal");
paragraph.ParagraphFormat.HorizontalAlignment = Syncfusion.DocIO.DLS.HorizontalAlignment.Left;
WTextRange textRange = paragraph.AppendText("Adventure Works Cycles") as WTextRange;
textRange.CharacterFormat.FontSize = 12f;
textRange.CharacterFormat.FontName = "Calibri";
//Appends paragraph.
paragraph = section.AddParagraph();
paragraph.ApplyStyle("Heading 1");
paragraph.ParagraphFormat.HorizontalAlignment = Syncfusion.DocIO.DLS.HorizontalAlignment.Center;
textRange = paragraph.AppendText("Adventure Works Cycles") as WTextRange;
textRange.CharacterFormat.FontSize = 18f;
textRange.CharacterFormat.FontName = "Calibri";
//Appends paragraph.
paragraph = section.AddParagraph();
paragraph.ParagraphFormat.FirstLineIndent = 36;
paragraph.BreakCharacterFormat.FontSize = 12f;
textRange = paragraph.AppendText("Adventure Works Cycles, the fictitious company on which the AdventureWorks sample databases are based, is a large, multinational manufacturing company. The company manufactures and sells metal and composite bicycles to North American, European and Asian commercial markets. While its base operation is located in Bothell, Washington with 290 employees, several regional sales teams are located throughout their market base.") as WTextRange;
textRange.CharacterFormat.FontSize = 12f;
paragraph = section.AddParagraph();
paragraph.ParagraphFormat.FirstLineIndent = 36;
paragraph.BreakCharacterFormat.FontSize = 12f;
textRange = paragraph.AppendText("In 2000, Adventure Works Cycles bought a small manufacturing plant, Importadores Neptuno, located in Mexico. Importadores Neptuno manufactures several critical subcomponents for the Adventure Works Cycles product line. These subcomponents are shipped to the Bothell location for final product assembly. In 2001, Importadores Neptuno, became the sole manufacturer and distributor of the touring bicycle product group.") as WTextRange;
textRange.CharacterFormat.FontSize = 12f;
paragraph = section.AddParagraph();
paragraph.ApplyStyle("Heading 1");
paragraph.ParagraphFormat.HorizontalAlignment = Syncfusion.DocIO.DLS.HorizontalAlignment.Left;
textRange = paragraph.AppendText("Product Overview") as WTextRange;
textRange.CharacterFormat.FontSize = 16f;
textRange.CharacterFormat.FontName = "Calibri";
//Appends table.
IWTable table = section.AddTable();
table.ResetCells(3, 2);
table.TableFormat.Borders.BorderType = BorderStyle.None;
table.TableFormat.IsAutoResized = true;
//Appends paragraph.
paragraph = table[0, 0].AddParagraph();
paragraph.ParagraphFormat.AfterSpacing = 0;
paragraph.BreakCharacterFormat.FontSize = 12f;
//Appends picture to the paragraph.
imageStream = execAssm.GetManifestResourceStream("Syncfusion.SampleBrowser.UWP.DocIO.DocIO.Assets.Mountain-200.jpg");
//Appends picture to the paragraph.
picture = paragraph.AppendPicture(imageStream) as WPicture;
picture.TextWrappingStyle = TextWrappingStyle.TopAndBottom;
picture.VerticalOrigin = VerticalOrigin.Paragraph;
picture.VerticalPosition = 4.5f;
picture.HorizontalOrigin = HorizontalOrigin.Column;
picture.HorizontalPosition = -2.15f;
picture.WidthScale = 79;
picture.HeightScale = 79;
//Appends paragraph.
paragraph = table[0, 1].AddParagraph();
paragraph.ApplyStyle("Heading 1");
paragraph.ParagraphFormat.AfterSpacing = 0;
paragraph.ParagraphFormat.LineSpacing = 12f;
paragraph.AppendText("Mountain-200");
//Appends paragraph.
paragraph = table[0, 1].AddParagraph();
paragraph.ParagraphFormat.AfterSpacing = 0;
paragraph.ParagraphFormat.LineSpacing = 12f;
paragraph.BreakCharacterFormat.FontSize = 12f;
paragraph.BreakCharacterFormat.FontName = "Times New Roman";
textRange = paragraph.AppendText("Product No: BK-M68B-38\r") as WTextRange;
textRange.CharacterFormat.FontSize = 12f;
textRange.CharacterFormat.FontName = "Times New Roman";
textRange = paragraph.AppendText("Size: 38\r") as WTextRange;
textRange.CharacterFormat.FontSize = 12f;
textRange.CharacterFormat.FontName = "Times New Roman";
textRange = paragraph.AppendText("Weight: 25\r") as WTextRange;
textRange.CharacterFormat.FontSize = 12f;
textRange.CharacterFormat.FontName = "Times New Roman";
textRange = paragraph.AppendText("Price: $2,294.99\r") as WTextRange;
textRange.CharacterFormat.FontSize = 12f;
textRange.CharacterFormat.FontName = "Times New Roman";
//Appends paragraph.
paragraph = table[0, 1].AddParagraph();
paragraph.ParagraphFormat.AfterSpacing = 0;
paragraph.ParagraphFormat.LineSpacing = 12f;
paragraph.BreakCharacterFormat.FontSize = 12f;
//Appends paragraph.
paragraph = table[1, 0].AddParagraph();
paragraph.ApplyStyle("Heading 1");
paragraph.ParagraphFormat.AfterSpacing = 0;
paragraph.ParagraphFormat.LineSpacing = 12f;
paragraph.AppendText("Mountain-300 ");
//Appends paragraph.
paragraph = table[1, 0].AddParagraph();
paragraph.ParagraphFormat.AfterSpacing = 0;
paragraph.ParagraphFormat.LineSpacing = 12f;
paragraph.BreakCharacterFormat.FontSize = 12f;
paragraph.BreakCharacterFormat.FontName = "Times New Roman";
textRange = paragraph.AppendText("Product No: BK-M47B-38\r") as WTextRange;
textRange.CharacterFormat.FontSize = 12f;
textRange.CharacterFormat.FontName = "Times New Roman";
textRange = paragraph.AppendText("Size: 35\r") as WTextRange;
textRange.CharacterFormat.FontSize = 12f;
textRange.CharacterFormat.FontName = "Times New Roman";
textRange = paragraph.AppendText("Weight: 22\r") as WTextRange;
textRange.CharacterFormat.FontSize = 12f;
textRange.CharacterFormat.FontName = "Times New Roman";
textRange = paragraph.AppendText("Price: $1,079.99\r") as WTextRange;
textRange.CharacterFormat.FontSize = 12f;
textRange.CharacterFormat.FontName = "Times New Roman";
//Appends paragraph.
paragraph = table[1, 0].AddParagraph();
paragraph.ParagraphFormat.AfterSpacing = 0;
paragraph.ParagraphFormat.LineSpacing = 12f;
paragraph.BreakCharacterFormat.FontSize = 12f;
//Appends paragraph.
paragraph = table[1, 1].AddParagraph();
paragraph.ApplyStyle("Heading 1");
paragraph.ParagraphFormat.LineSpacing = 12f;
//Appends picture to the paragraph.
imageStream = execAssm.GetManifestResourceStream("Syncfusion.SampleBrowser.UWP.DocIO.DocIO.Assets.Mountain-300.jpg");
//Appends picture to the paragraph.
picture = paragraph.AppendPicture(imageStream) as WPicture;
picture.TextWrappingStyle = TextWrappingStyle.TopAndBottom;
picture.VerticalOrigin = VerticalOrigin.Paragraph;
picture.VerticalPosition = 8.2f;
picture.HorizontalOrigin = HorizontalOrigin.Column;
picture.HorizontalPosition = -14.95f;
picture.WidthScale = 75;
picture.HeightScale = 75;
//Appends paragraph.
paragraph = table[2, 0].AddParagraph();
paragraph.ApplyStyle("Heading 1");
paragraph.ParagraphFormat.LineSpacing = 12f;
//Appends picture to the paragraph.
imageStream = execAssm.GetManifestResourceStream("Syncfusion.SampleBrowser.UWP.DocIO.DocIO.Assets.Road-550-W.jpg");
//Appends picture to the paragraph.
picture = paragraph.AppendPicture(imageStream) as WPicture;
picture.TextWrappingStyle = TextWrappingStyle.TopAndBottom;
picture.VerticalOrigin = VerticalOrigin.Paragraph;
picture.VerticalPosition = 3.75f;
picture.HorizontalOrigin = HorizontalOrigin.Column;
picture.HorizontalPosition = -5f;
picture.WidthScale = 92;
picture.HeightScale = 92;
//Appends paragraph.
paragraph = table[2, 1].AddParagraph();
paragraph.ApplyStyle("Heading 1");
paragraph.ParagraphFormat.AfterSpacing = 0;
paragraph.ParagraphFormat.LineSpacing = 12f;
paragraph.AppendText("Road-150 ");
//Appends paragraph.
paragraph = table[2, 1].AddParagraph();
paragraph.ParagraphFormat.AfterSpacing = 0;
paragraph.ParagraphFormat.LineSpacing = 12f;
paragraph.BreakCharacterFormat.FontSize = 12f;
paragraph.BreakCharacterFormat.FontName = "Times New Roman";
textRange = paragraph.AppendText("Product No: BK-R93R-44\r") as WTextRange;
textRange.CharacterFormat.FontSize = 12f;
textRange.CharacterFormat.FontName = "Times New Roman";
textRange = paragraph.AppendText("Size: 44\r") as WTextRange;
textRange.CharacterFormat.FontSize = 12f;
textRange.CharacterFormat.FontName = "Times New Roman";
textRange = paragraph.AppendText("Weight: 14\r") as WTextRange;
textRange.CharacterFormat.FontSize = 12f;
textRange.CharacterFormat.FontName = "Times New Roman";
textRange = paragraph.AppendText("Price: $3,578.27\r") as WTextRange;
textRange.CharacterFormat.FontSize = 12f;
textRange.CharacterFormat.FontName = "Times New Roman";
//Appends paragraph.
paragraph = table[2, 1].AddParagraph();
paragraph.ApplyStyle("Heading 1");
paragraph.ParagraphFormat.LineSpacing = 12f;
//Appends paragraph.
section.AddParagraph();
Save(rdDoc.IsChecked == true, document);
}
private async void Save(bool isDocFormat, WordDocument document)
{
StorageFile stgFile;
if (!(Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons")))
{
FileSavePicker savePicker = new FileSavePicker();
savePicker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary;
// Dropdown of file types the user can save the file as
if (isDocFormat)
savePicker.FileTypeChoices.Add("Word Document", new List<string>() { ".doc" });
else
savePicker.FileTypeChoices.Add("Word Document", new List<string>() { ".docx" });
// Default file name if the user does not type one in or select a file to replace
savePicker.SuggestedFileName = "Sample";
stgFile = await savePicker.PickSaveFileAsync();
}
else
{
StorageFolder local = Windows.Storage.ApplicationData.Current.LocalFolder;
stgFile = await local.CreateFileAsync("WordDocument.docx", CreationCollisionOption.ReplaceExisting);
}
if (stgFile != null)
{
MemoryStream stream = new MemoryStream();
if (isDocFormat)
await document.SaveAsync(stream, FormatType.Doc);
else
await document.SaveAsync(stream, FormatType.Docx);
document.Close();
stream.Position = 0;
Windows.Storage.Streams.IRandomAccessStream fileStream = await stgFile.OpenAsync(FileAccessMode.ReadWrite);
Stream st = fileStream.AsStreamForWrite();
st.SetLength(0);
st.Write((stream as MemoryStream).ToArray(), 0, (int)stream.Length);
st.Flush();
st.Dispose();
fileStream.Dispose();
MessageDialog msgDialog = new MessageDialog("Do you want to view the Document?", "File has been created successfully.");
UICommand yesCmd = new UICommand("Yes");
msgDialog.Commands.Add(yesCmd);
UICommand noCmd = new UICommand("No");
msgDialog.Commands.Add(noCmd);
IUICommand cmd = await msgDialog.ShowAsync();
if (cmd == yesCmd)
{
// Launch the retrieved file
bool success = await Windows.System.Launcher.LaunchFileAsync(stgFile);
}
}
}
}
}

Просмотреть файл

@ -1,72 +0,0 @@
<View:SampleLayout
x:Class="EssentialDocIO.HeadersAndFootersDemo"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:EssentialDocIO" xmlns:View="using:Common"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
xmlns:common="using:Common"
xmlns:Controls ="using:Syncfusion.UI.Xaml.Controls.Input">
<View:SampleLayout.Sample>
<ContentControl>
<Grid x:Name="HeaderFooter" Background="{StaticResource ApplicationPageBackgroundThemeBrush}" Padding="10,0,0,0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width=".5*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width=".5*"/>
</Grid.ColumnDefinitions>
<TextBlock x:Name="TextBlock1" Grid.Row="0" Grid.ColumnSpan="6" FontFamily="Segoe UI" FontSize="18"/>
<TextBlock x:Name="TextBlock2" Grid.Row="1" Grid.ColumnSpan="6" TextWrapping="Wrap" Text="This sample demonstrates the header and footer in Word document using Essential DocIO." FontFamily="Segoe UI" FontSize="20" Foreground="#333333"/>
<TextBlock x:Name="TextBlock3" Grid.Row="2" Grid.ColumnSpan="6" FontFamily="Segoe UI" FontSize="18"/>
<TextBlock x:Name="TextBlock4" Grid.Row="3" Grid.ColumnSpan="2" TextWrapping="Wrap" Text="Header and Footer" FontFamily="Segoe UI" FontSize="16" Foreground="#333333"/>
<Rectangle Grid.Row="3" Grid.RowSpan="5" Grid.Column="2" Width="1" StrokeThickness="0.75" Stroke="#666666"></Rectangle>
<TextBlock x:Name="TextBlock5" Grid.Row="3" Grid.Column="3" Grid.ColumnSpan="2" TextWrapping="Wrap" Text="Page Number" FontFamily="Segoe UI" FontSize="16" Foreground="#333333"/>
<TextBlock x:Name="TextBlock6" Grid.Row="4" Grid.ColumnSpan="6" FontFamily="Segoe UI" FontSize="16"/>
<CheckBox x:Name="checkBox1" Grid.Row="5" Grid.ColumnSpan="6" Content="Header and Footer for First page" IsChecked="True" FontFamily="Segoe UI" FontSize="16" Foreground="#333333" Width="256"/>
<TextBlock Grid.Row="5" Grid.Column="3" TextWrapping="Wrap" Text="Number Format" FontFamily="Segoe UI" FontSize="16" Foreground="#333333"/>
<ComboBox x:Name="comboBox1" Grid.Row="5" Grid.Column="4" Grid.ColumnSpan="1" FontFamily="Segoe UI" FontSize="16" Foreground="#333333"/>
<TextBlock Grid.Row="6" Grid.ColumnSpan="6" FontFamily="Segoe UI" FontSize="16"/>
<CheckBox x:Name="checkBox2" Grid.Row="7" Grid.ColumnSpan="6" Content="Header and Footer for All pages" FontFamily="Segoe UI" FontSize="16" Foreground="#333333" Width="252"/>
<TextBlock x:Name="TextBlock7" Grid.Row="7" Grid.Column="3" TextWrapping="Wrap" Text="Start At" FontFamily="Segoe UI" FontSize="16" Foreground="#333333"/>
<Controls:SfNumericUpDown FormatString="##" x:Name="numericUpDown1" Grid.Row="7" Grid.Column="4" Grid.ColumnSpan="1" Minimum="1" FontFamily="Segoe UI" FontSize="16" Foreground="#333333" AccentBrush="#FF656868"/>
<TextBlock x:Name="TextBlock8" Grid.Row="8" Grid.ColumnSpan="6" FontFamily="Segoe UI" FontSize="16"/>
<TextBlock x:Name="TextBlock9" Grid.Row="9" Grid.ColumnSpan="6" TextWrapping="Wrap" Text="Please click the Generate button to save and view the Word document generated by Essential DocIO." FontFamily="Segoe UI" FontSize="16" Foreground="#333333"/>
<TextBlock x:Name="TextBlock10" Grid.Row="10" Grid.ColumnSpan="6" FontFamily="Segoe UI" FontSize="16"/>
<TextBlock x:Name="TextBlock11" Grid.Row="11" TextWrapping="Wrap" Text="Save As" FontFamily="Segoe UI" FontSize="16" Foreground="#333333"/>
<TextBlock x:Name="TextBlock12" Grid.Row="12" Grid.ColumnSpan="6" FontFamily="Segoe UI" FontSize="14"/>
<StackPanel Name="stackPnlOptions" Grid.Row="13" Grid.ColumnSpan="4" Orientation="Horizontal" HorizontalAlignment="Left">
<RadioButton GroupName="Save As" Content="DOC" FontFamily="Segoe UI" FontSize="16" Foreground="#333333" x:Name="rdDoc" Width="150" />
<RadioButton GroupName="Save As" Content="DOCX" FontFamily="Segoe UI" FontSize="16" Foreground="#333333" x:Name="rdDocx" Width="150" IsChecked="True"/>
</StackPanel>
<TextBlock x:Name="TextBlock13" Grid.Row="14" Grid.ColumnSpan="6" FontFamily="Segoe UI" FontSize="16"/>
<TextBlock x:Name="TextBlock14" Grid.Row="15" Grid.ColumnSpan="6" FontFamily="Segoe UI" FontSize="16"/>
<Button x:Name="Button1" Grid.Row="16" Grid.ColumnSpan="4" Content="Generate" Click="Button_Click_1" FontFamily="Segoe UI" FontSize="16" Foreground="#FFFFFF" Background="#656868" Padding="30,10,30,10"/>
<TextBlock x:Name="TextBlock15" Grid.Row="17" Grid.ColumnSpan="6" FontFamily="Segoe UI" FontSize="16"/>
</Grid>
</ContentControl>
</View:SampleLayout.Sample>
</View:SampleLayout>

Просмотреть файл

@ -1,356 +0,0 @@
#region Copyright Syncfusion Inc. 2001-2024.
// Copyright Syncfusion Inc. 2001-2024. All rights reserved.
// Use of this code is subject to the terms of our license.
// A copy of the current license can be obtained at any time by e-mailing
// licensing@syncfusion.com. Any infringement will be prosecuted under
// applicable laws.
#endregion
using Common;
using Syncfusion.DocIO;
using Syncfusion.DocIO.DLS;
using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using Windows.Storage;
using Windows.Storage.Pickers;
using Windows.UI.Popups;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
namespace EssentialDocIO
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class HeadersAndFootersDemo : SampleLayout
{
public HeadersAndFootersDemo()
{
InitializeComponent();
//Associate PageNumberStyle Enum values to comboBox
foreach (String str in Enum.GetNames(typeof(PageNumberStyle)))
comboBox1.Items.Add(str);
comboBox1.SelectedIndex = 2;
}
public override void Dispose()
{
base.Dispose();
DisposeTextBlock(TextBlock1);
TextBlock1 = null;
DisposeTextBlock(TextBlock2);
TextBlock2 = null;
DisposeTextBlock(TextBlock3);
TextBlock3 = null;
DisposeTextBlock(TextBlock4);
TextBlock4 = null;
DisposeTextBlock(TextBlock5);
TextBlock5 = null;
DisposeTextBlock(TextBlock6);
TextBlock6 = null;
DisposeTextBlock(TextBlock7);
TextBlock7 = null;
DisposeTextBlock(TextBlock8);
TextBlock8 = null;
DisposeTextBlock(TextBlock9);
TextBlock9 = null;
DisposeTextBlock(TextBlock10);
TextBlock10 = null;
DisposeTextBlock(TextBlock11);
TextBlock11 = null;
DisposeTextBlock(TextBlock12);
TextBlock12 = null;
DisposeTextBlock(TextBlock13);
TextBlock13 = null;
DisposeTextBlock(TextBlock14);
TextBlock14 = null;
DisposeTextBlock(TextBlock15);
TextBlock15 = null;
Button1.Click -= Button_Click_1;
DisposeButton(Button1);
Button1 = null;
DisposeRadioButton(rdDoc);
rdDoc = null;
DisposeRadioButton(rdDocx);
rdDocx = null;
DisposeCheckBox(checkBox1);
checkBox1 = null;
DisposeCheckBox(checkBox2);
checkBox2 = null;
comboBox1.ClearValue(ComboBox.FontFamilyProperty);
comboBox1.ClearValue(ComboBox.FontSizeProperty);
comboBox1.ClearValue(ComboBox.ForegroundProperty);
comboBox1 = null;
stackPnlOptions.ClearValue(StackPanel.OrientationProperty);
stackPnlOptions.ClearValue(StackPanel.HorizontalAlignmentProperty);
stackPnlOptions = null;
HeaderFooter.ClearValue(Grid.BackgroundProperty);
HeaderFooter.ClearValue(Grid.PaddingProperty);
HeaderFooter.Children.Clear();
HeaderFooter.ColumnDefinitions.Clear();
HeaderFooter.RowDefinitions.Clear();
HeaderFooter = null;
}
public void DisposeCheckBox(CheckBox checkBox)
{
checkBox.ClearValue(CheckBox.FontFamilyProperty);
checkBox.ClearValue(CheckBox.FontSizeProperty);
checkBox.ClearValue(CheckBox.FontSizeProperty);
}
public void DisposeRadioButton(RadioButton radioButton)
{
radioButton.ClearValue(RadioButton.GroupNameProperty);
radioButton.ClearValue(RadioButton.ContentProperty);
radioButton.ClearValue(RadioButton.FontFamilyProperty);
radioButton.ClearValue(RadioButton.FontSizeProperty);
radioButton.ClearValue(RadioButton.ForegroundProperty);
radioButton.ClearValue(RadioButton.WidthProperty);
radioButton.ClearValue(RadioButton.IsCheckedProperty);
}
public void DisposeTextBlock(TextBlock textBlock)
{
textBlock.ClearValue(TextBlock.FontFamilyProperty);
textBlock.ClearValue(TextBlock.FontSizeProperty);
textBlock.ClearValue(TextBlock.TextProperty);
textBlock.ClearValue(TextBlock.TextWrappingProperty);
textBlock.ClearValue(TextBlock.ForegroundProperty);
}
public void DisposeButton(Button button)
{
button.ClearValue(Button.FontFamilyProperty);
button.ClearValue(Button.FontSizeProperty);
button.ClearValue(Button.PaddingProperty);
button.ClearValue(Button.ForegroundProperty);
button.ClearValue(Button.BackgroundProperty);
button.ClearValue(Button.ContentProperty);
button.ClearValue(Button.HeightProperty);
button.ClearValue(Button.WidthProperty);
}
private void Button_Click_1(object sender, RoutedEventArgs e)
{
// Creating a new document.
WordDocument doc = new WordDocument();
// Add a new section to the document.
IWSection section1 = doc.AddSection();
Assembly execAssm = typeof(HeadersAndFootersDemo).GetTypeInfo().Assembly;
#region Header Footer
//Add different Header Footer for first and other pages
if (checkBox1.IsChecked == true && checkBox2.IsChecked == true)
{
// Set the header/footer setup.
section1.PageSetup.DifferentFirstPage = true;
// Inserting Header Footer to first page
InsertFirstPageHeaderFooter(doc, section1);
// Inserting Header Footer to all pages
InsertPageHeaderFooter(doc, section1);
}
//Add Header Footer only for first page
if (checkBox1.IsChecked == true && checkBox2.IsChecked != true)
{
// Set the header/footer setup.
section1.PageSetup.DifferentFirstPage = true;
// Inserting Header Footer to first page
InsertFirstPageHeaderFooter(doc, section1);
}
//Add same Header Footer for all the pages
if (checkBox2.IsChecked == true && checkBox1.IsChecked != true)
{
// Inserting Header Footer to all pages
InsertPageHeaderFooter(doc, section1);
}
#endregion
// Add text to the document body section.
IWParagraph par;
par = section1.AddParagraph();
//Insert Text into the word Document.
Stream inputStream = execAssm.GetManifestResourceStream("Syncfusion.SampleBrowser.UWP.DocIO.DocIO.Assets.WinFAQ.txt");
StreamReader reader = new StreamReader(inputStream, System.Text.Encoding.Unicode);
string text = reader.ReadToEnd();
par.AppendText(text);
Save(rdDoc.IsChecked == true, doc);
}
private async void Save(bool isDocFormat, WordDocument document)
{
StorageFile stgFile;
if (!(Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons")))
{
FileSavePicker savePicker = new FileSavePicker();
savePicker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary;
// Dropdown of file types the user can save the file as
if (isDocFormat)
savePicker.FileTypeChoices.Add("Word Document", new List<string>() { ".doc" });
else
savePicker.FileTypeChoices.Add("Word Document", new List<string>() { ".docx" });
// Default file name if the user does not type one in or select a file to replace
savePicker.SuggestedFileName = "Sample";
stgFile = await savePicker.PickSaveFileAsync();
}
else
{
StorageFolder local = Windows.Storage.ApplicationData.Current.LocalFolder;
stgFile = await local.CreateFileAsync("WordDocument.docx", CreationCollisionOption.ReplaceExisting);
}
if (stgFile != null)
{
MemoryStream stream = new MemoryStream();
if (isDocFormat)
await document.SaveAsync(stream, FormatType.Doc);
else
await document.SaveAsync(stream, FormatType.Docx);
document.Close();
stream.Position = 0;
Windows.Storage.Streams.IRandomAccessStream fileStream = await stgFile.OpenAsync(FileAccessMode.ReadWrite);
Stream st = fileStream.AsStreamForWrite();
st.SetLength(0);
st.Write((stream as MemoryStream).ToArray(), 0, (int)stream.Length);
st.Flush();
st.Dispose();
fileStream.Dispose();
MessageDialog msgDialog = new MessageDialog("Do you want to view the Document?", "File has been created successfully.");
UICommand yesCmd = new UICommand("Yes");
msgDialog.Commands.Add(yesCmd);
UICommand noCmd = new UICommand("No");
msgDialog.Commands.Add(noCmd);
IUICommand cmd = await msgDialog.ShowAsync();
if (cmd == yesCmd)
{
// Launch the retrieved file
bool success = await Windows.System.Launcher.LaunchFileAsync(stgFile);
}
}
}
#region Helper Methods
#region InsertFirstPageHeaderFooter
private void InsertFirstPageHeaderFooter(WordDocument doc, IWSection section)
{
Assembly execAssm = typeof(HeadersAndFootersDemo).GetTypeInfo().Assembly;
Stream inputStream = execAssm.GetManifestResourceStream("Syncfusion.SampleBrowser.UWP.DocIO.DocIO.Assets.Northwind_logo.png");
// Add a new paragraph for header to the document.
IWParagraph headerPar = new WParagraph(doc);
// Add a new table to the header.
IWTable table = section.HeadersFooters.FirstPageHeader.AddTable();
RowFormat format = new RowFormat();
// Setting cleared table border style.
format.Borders.BorderType = Syncfusion.DocIO.DLS.BorderStyle.Cleared;
// Inserting table with a row and two columns.
table.ResetCells(1, 2, format, 265);
// Inserting logo image to the table first cell.
headerPar = table[0, 0].AddParagraph() as WParagraph;
headerPar.AppendPicture(inputStream);
//Set Image size
(headerPar.Items[0] as WPicture).Width = 232.5f;
(headerPar.Items[0] as WPicture).Height = 54.75f;
// Inserting text to the table second cell.
headerPar = table[0, 1].AddParagraph() as WParagraph;
IWTextRange txt = headerPar.AppendText("Company Headquarters,\n2501 Aerial Center Parkway,\nSuite 110, Morrisville, NC 27560,\nTEL 1-888-936-8638.");
txt.CharacterFormat.FontSize = 12;
txt.CharacterFormat.CharacterSpacing = 1.7f;
headerPar.ParagraphFormat.HorizontalAlignment = Syncfusion.DocIO.DLS.HorizontalAlignment.Right;
// Add a new paragraph to the header with address text.
headerPar = new WParagraph(doc);
headerPar.ParagraphFormat.HorizontalAlignment = Syncfusion.DocIO.DLS.HorizontalAlignment.Center;
txt = headerPar.AppendText("\nFirst Page Header");
txt.CharacterFormat.CharacterSpacing = 1.7f;
section.HeadersFooters.FirstPageHeader.Paragraphs.Add(headerPar);
// Add a footer paragraph text to the document.
WParagraph footerPar = new WParagraph(doc);
footerPar.ParagraphFormat.Tabs.AddTab(523f, TabJustification.Right, TabLeader.NoLeader);
// Add text.
footerPar.AppendText("Copyright Northwind Inc. 2001 - 2015");
// Add page and Number of pages field to the document.
footerPar.AppendText("\tFirst Page ");
footerPar.AppendField("Page", FieldType.FieldPage);
section.HeadersFooters.FirstPageFooter.Paragraphs.Add(footerPar);
#region Page Number Settings
section.PageSetup.RestartPageNumbering = true;
section.PageSetup.PageStartingNumber = Convert.ToInt32(this.numericUpDown1.Value);
section.PageSetup.PageNumberStyle = (PageNumberStyle)Enum.Parse(typeof(PageNumberStyle), this.comboBox1.SelectedItem.ToString(), true);
#endregion
}
#endregion
#region InsertPageHeaderFooter
private void InsertPageHeaderFooter(WordDocument doc, IWSection section1)
{
Assembly execAssm = typeof(HeadersAndFootersDemo).GetTypeInfo().Assembly;
Stream inputStream = execAssm.GetManifestResourceStream("Syncfusion.SampleBrowser.UWP.DocIO.DocIO.Assets.Northwind_logo.png");
// Add a new paragraph for header to the document.
IWParagraph headerPar = new WParagraph(doc);
// Add a new table to the header
IWTable table = section1.HeadersFooters.Header.AddTable();
RowFormat format = new RowFormat();
// Setting Single table border style.
format.Borders.BorderType = Syncfusion.DocIO.DLS.BorderStyle.Single;
// Inserting table with a row and two columns.
table.ResetCells(1, 2, format, 265);
// Inserting logo image to the table first cell.
headerPar = table[0, 0].AddParagraph() as WParagraph;
headerPar.AppendPicture(inputStream);
//Set Image size.
(headerPar.Items[0] as WPicture).Width = 232.5f;
(headerPar.Items[0] as WPicture).Height = 54.75f;
// Inserting text to the table second cell.
headerPar = table[0, 1].AddParagraph() as WParagraph;
IWTextRange txt = headerPar.AppendText("Company Headquarters,\n2501 Aerial Center Parkway,\nSuite 110, Morrisville, NC 27560,\nTEL 1-888-936-8638.");
txt.CharacterFormat.FontSize = 12;
txt.CharacterFormat.CharacterSpacing = 1.7f;
headerPar.ParagraphFormat.HorizontalAlignment = Syncfusion.DocIO.DLS.HorizontalAlignment.Right;
// Add a footer paragraph text to the document.
WParagraph footerPar = new WParagraph(doc);
footerPar.ParagraphFormat.Tabs.AddTab(523f, TabJustification.Right, TabLeader.NoLeader);
// Add text.
footerPar.AppendText("Copyright Northwind Inc. 2001 - 2015");
// Add page and Number of pages field to the document.
footerPar.AppendText("\tPage ");
IWField ff = footerPar.AppendField("Page", FieldType.FieldPage);
section1.HeadersFooters.Footer.Paragraphs.Add(footerPar);
#region Page Number Settings
section1.PageSetup.RestartPageNumbering = true;
section1.PageSetup.PageStartingNumber = Convert.ToInt32(this.numericUpDown1.Value);
section1.PageSetup.PageNumberStyle = (PageNumberStyle)Enum.Parse(typeof(PageNumberStyle), this.comboBox1.SelectedItem.ToString(), true);
#endregion
}
#endregion
#endregion
}
}

Просмотреть файл

@ -1,131 +0,0 @@
<Page
xmlns:Controls="using:Syncfusion.UI.Xaml.Controls.Input"
x:Class="Invoice.Address"
IsTabStop="false"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Invoice"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Page.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="ms-appx:///DocIO/Invoice/Common/IOStandardStyles.Xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Page.Resources>
<Grid x:Name="outerGrid">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="1.5*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid Background="#FF004051" Opacity="0.7" Grid.Row="0"></Grid>
<Grid x:Name="RootPanel" Grid.Row="1" Background="#FF004051">
<Grid.RowDefinitions>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="0.25*"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="1.5*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBlock Style="{StaticResource BasicTextStyle}" x:Name="Title" HorizontalAlignment="Center" VerticalAlignment="Bottom" Text="BILL TO" Grid.Column="1" Grid.Row="0" Grid.ColumnSpan="2" FontSize="32" FontWeight="Light"></TextBlock>
<TextBlock Style="{StaticResource BasicTextStyle}" HorizontalAlignment="Right" VerticalAlignment="Bottom" Text="Name" Grid.Column="1" Grid.Row="1" FontSize="18" Padding="0,0,15,5"></TextBlock>
<TextBlock Style="{StaticResource BasicTextStyle}" HorizontalAlignment="Right" TextWrapping="Wrap" VerticalAlignment="Bottom" Text="Address" Grid.Column="1" Grid.Row="2" FontSize="18" Padding="0,0,15,5"></TextBlock>
<Grid Grid.Column="3" Grid.Row="3">
<Grid.RowDefinitions>
<RowDefinition Height="0.2*"></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<TextBlock Style="{StaticResource BasicTextStyle}" HorizontalAlignment="Right" VerticalAlignment="Top" Text="DueDate" Grid.Column="3" Grid.Row="3" FontSize="18" Padding="0,0,15,5"></TextBlock>
</Grid>
<TextBlock Style="{StaticResource BasicTextStyle}" HorizontalAlignment="Right" VerticalAlignment="Bottom" Text="Date" Grid.Column="3" Grid.Row="1" FontSize="18" Padding="0,0,15,5"></TextBlock>
<Grid Grid.Column="3" Grid.Row="2">
<Grid.RowDefinitions>
<RowDefinition Height="0.2*"></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<TextBlock Style="{StaticResource BasicTextStyle}" HorizontalAlignment="Stretch" TextAlignment="Right" VerticalAlignment="Center" Text="Invoice No" FontSize="18" Grid.Row="1" Padding="0,0,15,5"></TextBlock>
</Grid>
<Grid Grid.Row="1" Grid.Column="2">
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<TextBox Text="{Binding Mode=TwoWay, Path=Name}" HorizontalAlignment="Left" Width="200" VerticalAlignment="Bottom" Name="nameField" FontFamily="Segoe UI" FontSize="18" Grid.Row="1" Grid.RowSpan="2"></TextBox>
</Grid>
<Grid Grid.Row="2" Grid.Column="2" Grid.RowSpan="2">
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition Height="5*"></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<TextBox FontFamily="Segoe UI" FontSize="18" Text="{Binding Mode=TwoWay, Path=Address}" TextWrapping="Wrap" HorizontalAlignment="Left" Width="200" VerticalAlignment="Stretch" Name="address" Grid.Row="1" Margin="0,0,0,4"/>
</Grid>
<Grid Grid.Row="3" Grid.Column="4">
<Grid.RowDefinitions>
<RowDefinition Height="0.15*"></RowDefinition>
<RowDefinition Height="2*"></RowDefinition>
</Grid.RowDefinitions>
<Controls:SfDatePicker Value="{Binding Mode=TwoWay, Path=DueDate}" Width="200" Grid.Row="1" HorizontalAlignment="Left" VerticalAlignment="Top" Name="dueDate" AccentBrush="#087196" />
</Grid>
<Grid Grid.Row="1" Grid.Column="4">
<Grid Grid.Row="3" Grid.Column="4">
<Controls:SfDatePicker Value="{Binding Mode=TwoWay, Path=Date}" Width="200" HorizontalAlignment="Left" VerticalAlignment="Bottom" Name="Date" AccentBrush="#087196" />
</Grid>
</Grid>
<Grid Grid.Row="2" Grid.Column="4">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="5*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="0.15*"></RowDefinition>
<RowDefinition Height="2*"></RowDefinition>
</Grid.RowDefinitions>
<TextBox Text="{Binding Mode=TwoWay, Path=InvoiceNumber}" HorizontalAlignment="Left" Width="200" VerticalAlignment="Center" Name="invoiceNo" Grid.Row="1" TextChanged="invoiceNo_TextChanged" Grid.ColumnSpan="2" Margin="0,13"></TextBox>
</Grid>
<Grid Grid.Row="4" Grid.Column="4">
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="0.2*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Button Foreground="White" HorizontalAlignment="Stretch" FontFamily="Segoe UI" FontSize="18" VerticalAlignment="Top" Name="updtButton" Content="Update" Grid.Row="0" Grid.Column="0" Grid.RowSpan="2" Click="updtButton_Click"></Button>
<Button Foreground="White" HorizontalAlignment="Stretch" FontFamily="Segoe UI" FontSize="18" VerticalAlignment="Top" Name="cancelButton" Content="Cancel" Grid.Row="0" Grid.Column="2" Grid.RowSpan="2" Click="cancelButton_Click"></Button>
</Grid>
<Grid Grid.Row="4" Grid.Column="3">
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
</Grid>
</Grid>
<Grid Background="#FF004051" Opacity="0.7" Grid.Row="2"></Grid>
</Grid>
</Page>

Просмотреть файл

@ -1,176 +0,0 @@
#region Copyright Syncfusion Inc. 2001-2024.
// Copyright Syncfusion Inc. 2001-2024. All rights reserved.
// Use of this code is subject to the terms of our license.
// A copy of the current license can be obtained at any time by e-mailing
// licensing@syncfusion.com. Any infringement will be prosecuted under
// applicable laws.
#endregion
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
namespace Invoice
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class Address : Page,IDisposable
{
public event EventHandler CloseRequested;
public event EventHandler UpdateRequested;
BillingInformation info;
/// <summary>
///
/// </summary>
public Address():this(new BillingInformation())
{
}
/// <summary>
///
/// </summary>
/// <param name="billInfo"></param>
public Address(BillingInformation billInfo)
{
this.InitializeComponent();
var bounds = Window.Current.Bounds;
this.Height = bounds.Height;
info = billInfo;
this.DataContext = info;
}
///// <summary>
///// Invoked when this page is about to be displayed in a Frame.
///// </summary>
///// <param name="e">Event data that describes how this page was reached. The Parameter
///// property is typically used to configure the page.</param>
//protected override void OnNavigatedTo(NavigationEventArgs e)
//{
//}
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void cancelButton_Click(object sender, RoutedEventArgs e)
{
if (CloseRequested != null)
CloseRequested(this, EventArgs.Empty);
}
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void updtButton_Click(object sender, RoutedEventArgs e)
{
BillingInfoEventArgs args = new BillingInfoEventArgs();
args.BillingInformation = info;
if (UpdateRequested != null)
UpdateRequested(this, args);
}
private void invoiceNo_TextChanged(object sender, TextChangedEventArgs e)
{
int value = 0;
if (int.TryParse(invoiceNo.Text, out value))
{
invoiceNo.BorderBrush = new SolidColorBrush(Windows.UI.Color.FromArgb(255, 0, 64, 81));
}
else
{
invoiceNo.BorderBrush = new SolidColorBrush(Windows.UI.Color.FromArgb(255, 255, 37, 37));
}
}
#region Implementation
/// <summary>
/// Releases unmanaged and - optionally - managed resources.
/// </summary>
public void Dispose()
{
UnlinkChildrens(this);
this.Resources.Clear();
Loaded -= cancelButton_Click;
Loaded -= updtButton_Click;
info = null;
}
/// <summary>
/// Unlinks the child elements from page.
/// </summary>
/// <param name="element"></param>
void UnlinkChildrens(UIElement element)
{
if (element == null)
return;
if (element is Panel)
{
for (int i = 0; i < (element as Panel).Children.Count; i++)
{
UIElement childElement = (element as Panel).Children[i];
UnlinkChildrens(childElement);
(element as Panel).Children.Remove(childElement);
i--;
}
}
else if (element is ItemsControl)
{
for (int j = 0; j < (element as ItemsControl).Items.Count; j++)
{
UIElement childElement = ((element as ItemsControl).Items[j] as UIElement);
if (childElement == null)
{
//(element as ItemsControl).Items.RemoveAt(j);
//j--;
}
else
{
UnlinkChildrens(childElement);
(element as ItemsControl).Items.Remove(childElement);
j--;
}
}
}
else if (element is ContentControl)
{
UnlinkChildrens((element as ContentControl).Content as UIElement);
(element as ContentControl).Content = null;
}
else if (element is UserControl)
{
UnlinkChildrens((element as UserControl).Content as UIElement);
(element as UserControl).Content = null;
}
}
#endregion
}
/// <summary>
///
/// </summary>
public class BillingInfoEventArgs : EventArgs,IDisposable
{
BillingInformation m_billInfo;
public BillingInformation BillingInformation
{
get { return m_billInfo; }
set { m_billInfo = value; }
}
public void Dispose()
{
m_billInfo = null;
}
}
}

Просмотреть файл

@ -1,20 +0,0 @@
<Application
x:Class="Invoice.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Invoice">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<!--
Styles that define common aspects of the platform look and feel
Required by Visual Studio project and item templates
-->
<ResourceDictionary Source="Common/StandardStyles.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>

Просмотреть файл

@ -1,105 +0,0 @@
#region Copyright Syncfusion Inc. 2001-2024.
// Copyright Syncfusion Inc. 2001-2024. All rights reserved.
// Use of this code is subject to the terms of our license.
// A copy of the current license can be obtained at any time by e-mailing
// licensing@syncfusion.com. Any infringement will be prosecuted under
// applicable laws.
#endregion
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Windows.ApplicationModel;
using Windows.ApplicationModel.Activation;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
// The Blank Application template is documented at http://go.microsoft.com/fwlink/?LinkId=234227
namespace Invoice
{
/// <summary>
/// Provides application-specific behavior to supplement the default Application class.
/// </summary>
sealed partial class App : Application
{
/// <summary>
/// Initializes the singleton application object. This is the first line of authored code
/// executed, and as such is the logical equivalent of main() or WinMain().
/// </summary>
public App()
{
this.InitializeComponent();
this.Suspending += OnSuspending;
}
/// <summary>
/// Invoked when the application is launched normally by the end user. Other entry points
/// will be used when the application is launched to open a specific file, to display
/// search results, and so forth.
/// </summary>
/// <param name="args">Details about the launch request and process.</param>
protected override void OnLaunched(LaunchActivatedEventArgs args)
{
Frame rootFrame = Window.Current.Content as Frame;
// Do not repeat app initialization when the Window already has content,
// just ensure that the window is active
if (rootFrame == null)
{
// Create a Frame to act as the navigation context and navigate to the first page
rootFrame = new Frame();
if (args.PreviousExecutionState == ApplicationExecutionState.Terminated)
{
//TODO: Load state from previously suspended application
}
// Place the frame in the current Window
Window.Current.Content = rootFrame;
}
if (rootFrame.Content == null)
{
// When the navigation stack isn't restored navigate to the first page,
// configuring the new page by passing required information as a navigation
// parameter
if (!rootFrame.Navigate(typeof(MainPage), args.Arguments))
{
throw new Exception("Failed to create initial page");
}
}
if (args.Arguments != "")
{
MainPage mainPage = rootFrame.Content as MainPage;
// Frame f=Window.Current.Content as Page;
mainPage.LaunchedFromToast(args.Arguments);
}
// Ensure the current window is active
Window.Current.Activate();
}
/// <summary>
/// Invoked when application execution is being suspended. Application state is saved
/// without knowing whether the application will be terminated or resumed with the contents
/// of memory still intact.
/// </summary>
/// <param name="sender">The source of the suspend request.</param>
/// <param name="e">Details about the suspend request.</param>
private void OnSuspending(object sender, SuspendingEventArgs e)
{
var deferral = e.SuspendingOperation.GetDeferral();
//TODO: Save application state and stop any background activity
deferral.Complete();
}
}
}

Двоичные данные
DocIO/DocIO/Invoice/Assets/About.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 1.4 KiB

Двоичные данные
DocIO/DocIO/Invoice/Assets/Add.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 2.2 KiB

Двоичные данные
DocIO/DocIO/Invoice/Assets/Delete.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 2.2 KiB

Двоичные данные
DocIO/DocIO/Invoice/Assets/Edit.jpg

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 1.0 KiB

Двоичные данные
DocIO/DocIO/Invoice/Assets/Edit.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 391 B

Двоичные данные
DocIO/DocIO/Invoice/Assets/Excel.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 1.8 KiB

Двоичные данные
DocIO/DocIO/Invoice/Assets/Export.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 1.7 KiB

Двоичные данные
DocIO/DocIO/Invoice/Assets/InvoiceTemplate.xlsx

Двоичный файл не отображается.

Двоичные данные
DocIO/DocIO/Invoice/Assets/Logo.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 801 B

Двоичные данные
DocIO/DocIO/Invoice/Assets/PDF.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 1.6 KiB

Просмотреть файл

@ -1,55 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<Products>
<Product>
<Name>ASP.NET MVC </Name>
<Rate>995</Rate>
</Product>
<Product>
<Name>ASP.NET Core </Name>
<Rate>995</Rate>
</Product>
<Product>
<Name>ASP.NET Web Forms </Name>
<Rate>995</Rate>
</Product>
<Product>
<Name>JavaScript </Name>
<Rate>995</Rate>
</Product>
<Product>
<Name>Xamarin </Name>
<Rate>995</Rate>
</Product>
<Product>
<Name>UWP </Name>
<Rate>995</Rate>
</Product>
<Product>
<Name>WinForms </Name>
<Rate>995</Rate>
</Product>
<Product>
<Name>WPF </Name>
<Rate>995</Rate>
</Product>
<Product>
<Name>File Formats </Name>
<Rate>995</Rate>
</Product>
<Product>
<Name>Dashboard Platform </Name>
<Rate>1995</Rate>
</Product>
<Product>
<Name>Data Integration Platform</Name>
<Rate>1995</Rate>
</Product>
<Product>
<Name>Big Data Platform </Name>
<Rate>1995</Rate>
</Product>
<Product>
<Name>Report Platform </Name>
<Rate>1995</Rate>
</Product>
</Products>

Двоичные данные
DocIO/DocIO/Invoice/Assets/SmallLogo.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 329 B

Двоичные данные
DocIO/DocIO/Invoice/Assets/SplashScreen.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 2.1 KiB

Двоичные данные
DocIO/DocIO/Invoice/Assets/StoreLogo.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 429 B

Двоичные данные
DocIO/DocIO/Invoice/Assets/Syncfusion.PNG

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 24 KiB

Двоичные данные
DocIO/DocIO/Invoice/Assets/SyncfusionLogo.jpg

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 80 KiB

Двоичные данные
DocIO/DocIO/Invoice/Assets/Template.docx

Двоичный файл не отображается.

Двоичные данные
DocIO/DocIO/Invoice/Assets/Word.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 1.7 KiB

Двоичные данные
DocIO/DocIO/Invoice/Assets/invoice.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 27 KiB

Просмотреть файл

@ -1,75 +0,0 @@
#region Copyright Syncfusion Inc. 2001-2024.
// Copyright Syncfusion Inc. 2001-2024. All rights reserved.
// Use of this code is subject to the terms of our license.
// A copy of the current license can be obtained at any time by e-mailing
// licensing@syncfusion.com. Any infringement will be prosecuted under
// applicable laws.
#endregion
using System;
namespace Invoice
{
public class BillingInformation
{
#region Fields
private string m_Name;
private string m_Address;
private DateTime m_DueDate;
private string m_InvoiveNumber;
private DateTime m_date;
#endregion
#region Properties
/// <summary>
/// Gets or Sets the Name
/// </summary>
public string Name
{
get { return m_Name; }
set { m_Name = value; }
}
/// <summary>
/// Gets or Sets the Address
/// </summary>
public string Address
{
get { return m_Address; }
set { m_Address = value; }
}
/// <summary>
/// Gets or Sets the Date
/// </summary>
public DateTime Date
{
get { return m_date; }
set { m_date = value; }
}
/// <summary>
/// Gets or Sets the Invoice
/// </summary>
public string InvoiceNumber
{
get { return m_InvoiveNumber; }
set { m_InvoiveNumber = value; }
}
/// <summary>
/// Gets or Sets the Due Date
/// </summary>
public DateTime DueDate
{
get { return m_DueDate; }
set { m_DueDate = value; }
}
#endregion
#region Constructor
/// <summary>
///
/// </summary>
public BillingInformation()
{
}
#endregion
}
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -1,65 +0,0 @@
<Page
xmlns:Controls="using:Syncfusion.UI.Xaml.Controls.Input"
x:Class="Invoice.Address"
IsTabStop="false"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Invoice"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Page.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="ms-appx:///DocIO/Invoice/Common/IOStandardStyles.Xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Page.Resources>
<Grid x:Name="outerGrid">
<Grid.RowDefinitions>
<RowDefinition Height="0.5*"/>
<RowDefinition Height="1.2*"/>
<RowDefinition Height="0.5*"/>
</Grid.RowDefinitions>
<Grid Background="#FF004051" Opacity="0.7" Grid.Row="0"></Grid>
<Grid x:Name="RootPanel" Grid.Row="1" Background="#FF004051">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="1.5*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBlock Style="{StaticResource BasicTextStyle}" x:Name="Title" HorizontalAlignment="Left" VerticalAlignment="Center" Text="BILL TO" Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="2" FontSize="32" FontWeight="Bold" Padding="10,0,0,0"></TextBlock>
<TextBlock Style="{StaticResource BasicTextStyle}" HorizontalAlignment="Center" VerticalAlignment="Center" Text="Name" Grid.Column="0" Grid.Row="1" FontSize="13.333" ></TextBlock>
<TextBox Text="{Binding Mode=TwoWay, Path=Name}" HorizontalAlignment="Left" Width="Auto" VerticalAlignment="Center" Name="nameField" FontFamily="Segoe UI" FontSize="13.333" Grid.Row="1" Grid.Column="1"></TextBox>
<TextBlock Style="{StaticResource BasicTextStyle}" HorizontalAlignment="Center" VerticalAlignment="Center" Text="Address" Grid.Column="0" Grid.Row="2" FontSize="13.333" ></TextBlock>
<TextBox FontFamily="Segoe UI" FontSize="13.333" Text="{Binding Mode=TwoWay, Path=Address}" TextWrapping="Wrap" HorizontalAlignment="Left" Width="200" VerticalAlignment="Stretch" Name="address" Grid.Row="2" Grid.Column="1" />
<TextBlock Style="{StaticResource BasicTextStyle}" HorizontalAlignment="Center" VerticalAlignment="Center" Text="Date" Grid.Column="0" Grid.Row="3" FontSize="13.333" ></TextBlock>
<Controls:SfDatePicker Value="{Binding Mode=TwoWay, Path=Date}" Width="200" HorizontalAlignment="Left" VerticalAlignment="Center" Name="Date" AccentBrush="#087196" Grid.Column="1" Grid.Row="3" FontSize="13.333"/>
<TextBlock Style="{StaticResource BasicTextStyle}" HorizontalAlignment="Center" VerticalAlignment="Center" TextWrapping="Wrap" Text="Invoice No" FontSize="13.333" Grid.Row="4" ></TextBlock>
<TextBox Text="{Binding Mode=TwoWay, Path=InvoiceNumber}" HorizontalAlignment="Left" Width="200" VerticalAlignment="Center" Name="invoiceNo" Grid.Row="4" Grid.Column="1" TextChanged="invoiceNo_TextChanged" FontSize="13.333"></TextBox>
<TextBlock Style="{StaticResource BasicTextStyle}" HorizontalAlignment="Center" VerticalAlignment="Center" Text="DueDate" Grid.Column="0" Grid.Row="5" FontSize="13.333" ></TextBlock>
<Controls:SfDatePicker Value="{Binding Mode=TwoWay, Path=DueDate}" Width="200" Grid.Column="1" Grid.Row="5" HorizontalAlignment="Left" VerticalAlignment="Center" Name="dueDate" AccentBrush="#087196" FontSize="13.333" />
<Grid Grid.Row="6" Grid.ColumnSpan="2">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="0.2*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Button Foreground="White" HorizontalAlignment="Stretch" FontFamily="Segoe UI" FontSize="16" VerticalAlignment="Center" Name="updtButton" Content="Update" Grid.Column="0" Click="updtButton_Click" Grid.ColumnSpan="2" Margin="9,0,10.333,0" Height="36"></Button>
<Button Foreground="White" HorizontalAlignment="Stretch" FontFamily="Segoe UI" FontSize="16" VerticalAlignment="Center" Name="cancelButton" Content="Cancel" Grid.Column="2" Click="cancelButton_Click"></Button>
</Grid>
</Grid>
<Grid Background="#FF004051" Opacity="0.7" Grid.Row="2"></Grid>
</Grid>
</Page>

Просмотреть файл

@ -1,67 +0,0 @@
<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Invoice"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:Controls="using:Syncfusion.UI.Xaml.Controls.Input"
x:Class="Invoice.Dialog"
IsTabStop="false"
mc:Ignorable="d">
<Page.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="ms-appx:///DocIO/Invoice/Common/IOStandardStyles.Xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Page.Resources>
<Grid x:Name="outerGrid">
<Grid.RowDefinitions>
<RowDefinition Height="0.5*"/>
<RowDefinition Height="1.2*"/>
<RowDefinition Height="0.5*"/>
</Grid.RowDefinitions>
<Grid Background="#FF004051" Opacity="0.7" Grid.Row="0"/>
<Grid x:Name="RootPanel" Grid.Row="1" Background="#FF004051">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="1.5*"/>
</Grid.ColumnDefinitions>
<TextBlock Style="{StaticResource BasicTextStyle}" x:Name="Title" HorizontalAlignment="Left" VerticalAlignment="Center" Text="Edit the fields" Grid.Row="0" Grid.ColumnSpan="2" FontSize="32" FontWeight="Bold" Padding="10,0,0,0"/>
<TextBlock Style="{StaticResource BasicTextStyle}" HorizontalAlignment="Center" VerticalAlignment="Center" Text="Item" Grid.Column="0" Grid.Row="1" FontSize="13.333" Padding="0,0,15,5"/>
<ComboBox TabIndex="0" VerticalAlignment="Center" FontFamily="Segoe UI" FontSize="13.333" HorizontalAlignment="Stretch" x:Name="item" Grid.Row="1" Grid.Column="1" SelectionChanged="item_SelectionChanged" TabNavigation="Local" />
<TextBlock Style="{StaticResource BasicTextStyle}" HorizontalAlignment="Center" TextWrapping="Wrap" VerticalAlignment="Center" Text="Quantity" Grid.Column="0" Grid.Row="2" FontSize="13.333" Padding="0,0,15,5"/>
<Controls:SfNumericUpDown FormatString="##" AccentBrush="#087196" FontFamily="Segoe UI" FontSize="13.333" Value="{Binding Quantity, Mode=TwoWay}" HorizontalAlignment="Stretch" VerticalAlignment="Center" x:Name="quantity" Grid.Row="2" Grid.Column="1" Minimum="1" ValueChanged="quantity_ValueChanged" TabIndex="1" />
<TextBlock Style="{StaticResource BasicTextStyle}" HorizontalAlignment="Center" VerticalAlignment="Center" Text="Price" Grid.Column="0" Grid.Row="3" FontSize="13.333" Padding="0,0,15,5"/>
<Controls:SfNumericTextBox IsReadOnly="True" FormatString="$##.##" FontFamily="Segoe UI" FontSize="13.333" Text="{Binding Rate, Mode=TwoWay}" HorizontalAlignment="Stretch" VerticalAlignment="Center" x:Name="rate" Grid.Row="3" Grid.Column="1" />
<TextBlock Style="{StaticResource BasicTextStyle}" HorizontalAlignment="Center" VerticalAlignment="Center" Text="Taxes" Grid.Column="0" Grid.Row="4" FontSize="13.333" Padding="0,0,15,3"/>
<TextBlock HorizontalAlignment="Stretch" Text="{Binding Taxes, Mode=TwoWay}" FontFamily="Segoe UI" FontWeight="Light" FontSize="21.333" VerticalAlignment="Center" x:Name="taxesTextBlock" Grid.Row="4" Grid.Column="1" Foreground="#FF549BAE"/>
<TextBlock Style="{StaticResource BasicTextStyle}" HorizontalAlignment="Center" TextAlignment="Right" VerticalAlignment="Center" Text="Total Amount" Grid.Column="0" Grid.Row="5" FontSize="13.333" Padding="0,10,15,5"/>
<TextBlock HorizontalAlignment="Stretch" FontFamily="Segoe UI" FontWeight="Light" FontSize="21.333" VerticalAlignment="Center" x:Name="totalAmount" Foreground="#FF549BAE" Grid.Column="1" Grid.Row="5"/>
<Grid Grid.Row="6" Grid.ColumnSpan="2">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="0.2*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Button Foreground="White" HorizontalAlignment="Stretch" FontFamily="Segoe UI" FontSize="16" VerticalAlignment="Center" x:Name="updtButton" Content="Update" Grid.Row="0" Grid.Column="0" Click="updtButton_Click" TabIndex="4" Grid.ColumnSpan="2" Margin="9,0,10,0"/>
<Button Foreground="White" HorizontalAlignment="Stretch" FontFamily="Segoe UI" FontSize="16" VerticalAlignment="Center" x:Name="cancelButton" Content="Cancel" Grid.Row="0" Grid.Column="2" Click="cancelButton_Click" TabIndex="5"/>
</Grid>
</Grid>
<Grid Background="#FF004051" Opacity="0.7" Grid.Row="2"/>
</Grid>
</Page>

Просмотреть файл

@ -1,222 +0,0 @@
<Page
x:Class="Invoice.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Invoice"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Foreground="White">
<Page.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="ms-appx:///DocIO/Invoice/Common/IOStandardStyles.Xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Page.Resources>
<Page.BottomAppBar>
<AppBar Background="#087196" BorderBrush="#087196" x:Name="BottomAppBar1" AutomationProperties.Name="Bottom App Bar">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="40"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="30"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="30"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="10"/>
</Grid.ColumnDefinitions>
<AppBarButton Grid.Column="1" x:Name="PDFExport" Style="{StaticResource PDFExportAppBarButtonStyle}" Click="PDFExport_Click" Tag="Export To PDF"/>
<AppBarButton Grid.Column="3" x:Name="WordExport" Style="{StaticResource WordExportAppBarButtonStyle}" Click="WordExport_Click" Tag="Export To Word"/>
<AppBarButton Grid.Column="5" x:Name="ExcelExport" Style="{StaticResource ExcelExportAppBarButtonStyle}" Click="ExcelExport_Click" Tag="Export To Excel"/>
</Grid>
</AppBar>
</Page.BottomAppBar>
<Grid x:Name="root">
<Grid x:Name="MainGrid">
<Grid.RowDefinitions>
<RowDefinition Height="0.25*"/>
<RowDefinition Height="2*"/>
</Grid.RowDefinitions>
<!-- Back button and page title -->
<Grid x:Name = "Header" Background="#087196">
<Grid.RowDefinitions>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.02*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid Grid.Column="1" >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="4*"></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="0.2*"></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="0.2*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBlock Style="{StaticResource HeaderTextStyle}" x:Name="pageTitle" VerticalAlignment="Center" Text="Invoice" FontSize="56" FontFamily="Segoe UI" FontWeight="Light"/>
<Button Style="{StaticResource ExportButtonStyle}" Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Center" Click="Export"/>
</Grid>
</Grid>
<Grid x:Name="ContentGrid" Grid.Row="1" Background="White">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.05*"/>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="0.05*"/>
</Grid.ColumnDefinitions>
<Grid x:Name = "Layer1" Grid.Column="1">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="0.05*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid x:Name = "Level1" Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.5*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TextBlock Grid.Row="0" Grid.Column="0" x:Name = "BILLTO" Text = "BILL TO" FontSize="13.333" Foreground="#404435" Padding="0,2,0,0" FontWeight="Bold"/>
<Button Style="{ StaticResource EditButtonStyle}" VerticalAlignment="Top" Padding="0" HorizontalAlignment="Right" Grid.Row="0" Grid.Column="1" Click="EditBillingDetails">
<Image Source="Assets/Edit.jpg"/>
</Button>
<TextBlock Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" x:Name = "NameTextBlock" FontSize="13.333" Foreground="#808285" Padding="0,1,0,0"/>
<TextBlock Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" x:Name = "BillingAddress" TextWrapping="Wrap" FontSize="13.333" Foreground="#808285" Padding="0,1,0,0"/>
<TextBlock Grid.Row="3" Grid.Column="0" Text = "DATE: " FontWeight="Bold" FontSize="13.333" Foreground="#404435" Padding="0,1,0,0"/>
<TextBlock Grid.Row="3" Grid.Column="1" x:Name = "DATE" FontSize="13.333" Foreground="#808285" Padding="0,1,0,0"/>
<TextBlock Grid.Row="4" Grid.Column="0" Text = "INVOICE NO: " FontWeight="Bold" FontSize="13.333" Foreground="#404435" Padding="0,1,0,0"/>
<TextBlock Grid.Row="4" Grid.Column="1" x:Name = "InvoiceNumber" FontSize="13.333" Foreground="#808285" Padding="0,1,0,0"/>
<TextBlock Grid.Row="5" Grid.Column="0" Text = "DUE DATE: " FontWeight="Bold" FontSize="13.333" Foreground="#404435" Padding="0,1,0,0"/>
<TextBlock Grid.Row="5" Grid.Column="1" x:Name = "DueDate" FontSize="13.333" Foreground="#808285" Padding="0,1,0,0"/>
</Grid>
<Grid Grid.Row="1" Name="InvoiceGridHeader">
<Grid.RowDefinitions>
<RowDefinition Height="25"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1.2*"/>
<ColumnDefinition Width="0.7*"/>
<ColumnDefinition Width="0.7*"/>
<ColumnDefinition Width="0.7*"/>
<ColumnDefinition Width="0.7*"/>
</Grid.ColumnDefinitions>
<StackPanel Background="#B3D1E8" Grid.Column="0">
<Grid Height="25">
<TextBlock Padding="10,0,0,0" x:Name="Item" Text="Item" HorizontalAlignment="Stretch" TextAlignment="Left" VerticalAlignment="Center" FontWeight="Bold" FontFamily="Segoe UI" Foreground="#3F3F3F" FontSize="13.333"/>
</Grid>
</StackPanel>
<StackPanel Background="#B3D1E8" Grid.Column="1">
<Grid Height="25">
<TextBlock x:Name="Quantity" Text="Quantity" Padding="0,0,10,0" TextAlignment="Right" HorizontalAlignment="Stretch" FontWeight="Bold" FontFamily="Segoe UI" Foreground="#3F3F3F" FontSize="13.333" VerticalAlignment="Center"/>
</Grid>
</StackPanel>
<StackPanel Background="#B3D1E8" Grid.Column="2">
<Grid Height="25">
<TextBlock x:Name="Rate" Text="Rate" Padding="0,0,10,0" TextAlignment="Right" HorizontalAlignment="Stretch" FontWeight="Bold" FontFamily="Segoe UI" Foreground="#3F3F3F" FontSize="13.333" VerticalAlignment="Center"/>
</Grid>
</StackPanel>
<StackPanel Background="#B3D1E8" Grid.Column="3">
<Grid Height="25">
<TextBlock x:Name="Taxes" Text="Taxes" Padding="0,0,10,0" TextAlignment="Right" HorizontalAlignment="Stretch" FontWeight="Bold" FontFamily="Segoe UI" Foreground="#3F3F3F" FontSize="13.333" VerticalAlignment="Center"/>
</Grid>
</StackPanel>
<StackPanel VerticalAlignment="Stretch" Background="#B3D1E8" Grid.Column="4">
<Grid Height="25">
<TextBlock x:Name="Amount" Text="Amount" Padding="0,0,10,0" TextAlignment="Right" HorizontalAlignment="Stretch" FontWeight="Bold" VerticalAlignment="Center" FontFamily="Segoe UI" Foreground="#3F3F3F" FontSize="13.333"/>
</Grid>
</StackPanel>
</Grid>
<ScrollViewer x:Name="GridScrollViewer" Grid.Row="2" Height="{Binding InvoiceGrid.ActualHeight}" VerticalScrollBarVisibility="Auto" BorderBrush="AliceBlue" FontSize="9.333">
<Grid Name="InvoiceGrid" Tapped="InvoiceGrid_Tapped" DoubleTapped="InvoiceGrid_DoubleTapped">
<Grid.RowDefinitions>
<RowDefinition Height="30"/>
<RowDefinition Height="30"/>
<RowDefinition Height="30"/>
<RowDefinition Height="30"/>
<RowDefinition Height="30"/>
<RowDefinition Height="30"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1.2*"/>
<ColumnDefinition Width="0.7*"/>
<ColumnDefinition Width="0.7*"/>
<ColumnDefinition Width="0.7*"/>
<ColumnDefinition Width="0.7*"/>
</Grid.ColumnDefinitions>
<Rectangle Grid.Row="0" Height="1" StrokeThickness="0.75" VerticalAlignment="Bottom" Grid.ColumnSpan="5" StrokeDashArray="4,4" Stroke="#FFCECECE"></Rectangle>
<Rectangle Grid.Row="1" Height="1" StrokeThickness="0.75" VerticalAlignment="Bottom" Grid.ColumnSpan="5" StrokeDashArray="4,4" Stroke="#FFCECECE"></Rectangle>
<Rectangle Grid.Row="2" Height="1" StrokeThickness="0.75" VerticalAlignment="Bottom" Grid.ColumnSpan="5" StrokeDashArray="4,4" Stroke="#FFCECECE"></Rectangle>
<Rectangle Grid.Row="3" Height="1" StrokeThickness="0.75" VerticalAlignment="Bottom" Grid.ColumnSpan="5" StrokeDashArray="4,4" Stroke="#FFCECECE"></Rectangle>
<Rectangle Grid.Row="4" Height="1" StrokeThickness="0.75" VerticalAlignment="Bottom" Grid.ColumnSpan="5" StrokeDashArray="4,4" Stroke="#FFCECECE"></Rectangle>
<Rectangle Grid.Row="5" Height="1" StrokeThickness="0.75" VerticalAlignment="Bottom" Grid.ColumnSpan="5" StrokeDashArray="4,4" Stroke="#FFCECECE"></Rectangle>
</Grid>
</ScrollViewer>
<Grid x:Name="Events" Grid.Row="4">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="0.1*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="1.4*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="0.2*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Button Grid.Column="0" Style="{StaticResource EditButtonStyle}" HorizontalAlignment="Center" VerticalAlignment="Top" x:Name="AddButton" Click="Add" >
<Image Source="ms-appx:///DocIO/Invoice/Assets/Add.png" Width="50" Height="50" VerticalAlignment="Top"/>
</Button>
<Button Grid.Column="2" IsEnabled="False" Style="{StaticResource EditButtonStyle}" HorizontalAlignment="Center" VerticalAlignment="Top" x:Name="DeleteButton" Click="Delete" >
<Image Source="ms-appx:///DocIO/Invoice/Assets/Delete.png" Height="50" Width="50" VerticalAlignment="Top"/>
</Button>
</Grid>
<Grid Grid.Column="3" Grid.ColumnSpan="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="0.1*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TextBlock Grid.Row="1" Grid.Column="0" HorizontalAlignment="Right" VerticalAlignment="Top" TextWrapping="Wrap" Text="Total Due:" Foreground="#404435" FontSize="13.333" FontWeight="Bold"/>
<TextBlock Grid.Row="1" Grid.Column="1" x:Name="TotalAmount" TextWrapping="Wrap" HorizontalAlignment="Stretch" TextAlignment="Center" Foreground="#404435" FontSize="18.667" VerticalAlignment="Top"/>
</Grid>
</Grid>
</Grid>
</Grid>
</Grid>
<Grid HorizontalAlignment="Center" VerticalAlignment="Center"
Background="#087196" x:Name="progress" Visibility="Collapsed">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition />
</Grid.ColumnDefinitions>
<ProgressRing Width="30" Height="30" Foreground="White" IsActive="True" Margin="15"
VerticalAlignment="Center"/>
<TextBlock Text="Generating invoice" Foreground="White" Margin="10"
VerticalAlignment="Center" FontSize="13.333" Grid.Column="1"/>
</Grid>
</Grid>
</Page>

Просмотреть файл

@ -1,82 +0,0 @@
#region Copyright Syncfusion Inc. 2001-2024.
// Copyright Syncfusion Inc. 2001-2024. All rights reserved.
// Use of this code is subject to the terms of our license.
// A copy of the current license can be obtained at any time by e-mailing
// licensing@syncfusion.com. Any infringement will be prosecuted under
// applicable laws.
#endregion
using Syncfusion.XlsIO;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using Windows.Storage;
using Windows.Storage.Pickers;
using Windows.UI.Notifications;
using Windows.UI.Popups;
namespace Invoice
{
public class ExportToExcel
{
public async void GenerateReport(IList<InvoiceItem> items, BillingInformation billInfo)
{
Assembly executingAssembly = typeof(MainPage).GetTypeInfo().Assembly;
Stream inputStream = executingAssembly.GetManifestResourceStream("Syncfusion.SampleBrowser.UWP.DocIO.DocIO.Invoice.Assets.InvoiceTemplate.xlsx");
ExcelEngine excelEngine = new ExcelEngine();
IWorkbook book = await excelEngine.Excel.Workbooks.OpenAsync(inputStream);
inputStream.Dispose();
//Create Template Marker Processor
ITemplateMarkersProcessor marker = book.CreateTemplateMarkersProcessor();
//Binding the business object with the marker.
marker.AddVariable("InvoiceItem", items);
marker.AddVariable("BillInfo", billInfo);
marker.AddVariable("Company", billInfo);
//Applies the marker.
marker.ApplyMarkers(UnknownVariableAction.Skip);
StorageFile storageFile = null;
if (!(Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons")))
{
FileSavePicker savePicker = new FileSavePicker();
savePicker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary;
savePicker.SuggestedFileName = "Invoice";
savePicker.FileTypeChoices.Add("Invoice", new List<string>() { ".xlsx", });
storageFile = await savePicker.PickSaveFileAsync();
}
else
{
StorageFolder local = Windows.Storage.ApplicationData.Current.LocalFolder;
storageFile = await local.CreateFileAsync("SpreadsheetSample.xlsx", CreationCollisionOption.ReplaceExisting);
}
if (storageFile != null)
{
IWorksheet sheet = book.Worksheets[0];
sheet["G1"].ColumnWidth = 10;
//XlsIO saves the file Asynchronously
await book.SaveAsAsync(storageFile);
book.Close();
excelEngine.Dispose();
MessageDialog msgDialog = new MessageDialog("Do you want to view the Document?", "File has been created successfully.");
UICommand yesCmd = new UICommand("Yes");
msgDialog.Commands.Add(yesCmd);
UICommand noCmd = new UICommand("No");
msgDialog.Commands.Add(noCmd);
IUICommand cmd = await msgDialog.ShowAsync();
if (cmd == yesCmd)
{
// Launch the saved file
bool success = await Windows.System.Launcher.LaunchFileAsync(storageFile);
}
}
}
}
}

Просмотреть файл

@ -1,121 +0,0 @@
<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Invoice"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:Controls="using:Syncfusion.UI.Xaml.Controls.Input"
x:Class="Invoice.Dialog"
IsTabStop="false"
mc:Ignorable="d">
<Page.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="ms-appx:///DocIO/Invoice/Common/IOStandardStyles.Xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Page.Resources>
<Grid x:Name="outerGrid">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid Background="#FF004051" Opacity="0.7" Grid.Row="0"/>
<Grid x:Name="RootPanel" Grid.Row="1" Background="#FF004051">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition Height="*"/>
<RowDefinition Height="0.15*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="1.5*"/>
</Grid.ColumnDefinitions>
<TextBlock Style="{StaticResource BasicTextStyle}" x:Name="Title" HorizontalAlignment="Center" VerticalAlignment="Bottom" Text="Edit the fields" Grid.Column="1" Grid.Row="0" Grid.ColumnSpan="2" FontSize="32" FontWeight="Light"/>
<TextBlock Style="{StaticResource BasicTextStyle}" HorizontalAlignment="Right" VerticalAlignment="Bottom" Text="Item" Grid.Column="1" Grid.Row="1" FontSize="18" Padding="0,0,15,5"/>
<TextBlock Style="{StaticResource BasicTextStyle}" HorizontalAlignment="Right" TextWrapping="Wrap" VerticalAlignment="Bottom" Text="Quantity" Grid.Column="1" Grid.Row="2" FontSize="18" Padding="0,0,15,5"/>
<TextBlock Style="{StaticResource BasicTextStyle}" HorizontalAlignment="Right" VerticalAlignment="Bottom" Text="Price" Grid.Column="1" Grid.Row="3" FontSize="18" Padding="0,0,15,5"/>
<TextBlock Style="{StaticResource BasicTextStyle}" HorizontalAlignment="Right" VerticalAlignment="Bottom" Text="Taxes" Grid.Column="3" Grid.Row="1" FontSize="18" Padding="0,0,15,3"/>
<TextBlock Style="{StaticResource BasicTextStyle}" HorizontalAlignment="Stretch" TextAlignment="Right" VerticalAlignment="Center" Text="Total Amount" Grid.Column="3" Grid.Row="2" Grid.RowSpan="2" FontSize="18" Padding="0,10,15,5"/>
<Grid Grid.Row="1" Grid.Column="2">
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<ComboBox TabIndex="0" VerticalAlignment="Center" FontFamily="Segoe UI" FontSize="18" HorizontalAlignment="Stretch" x:Name="item" Grid.Row="1" Grid.RowSpan="2" SelectionChanged="item_SelectionChanged" TabNavigation="Local" Height="40" Margin="0,3.5,0,-0.5" />
</Grid>
<Grid Grid.Row="2" Grid.Column="2">
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<Controls:SfNumericUpDown FormatString="##" AccentBrush="#087196" FontFamily="Segoe UI" FontSize="18" Value="{Binding Quantity, Mode=TwoWay}" HorizontalAlignment="Stretch" VerticalAlignment="Bottom" x:Name="quantity" Grid.Row="1" Grid.RowSpan="2" Minimum="1" ValueChanged="quantity_ValueChanged" TabIndex="1" /><!--Background="#FF004051"-->
</Grid>
<Grid Grid.Row="3" Grid.Column="2">
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<Controls:SfNumericTextBox IsReadOnly="True" FormatString="$##.##" FontFamily="Segoe UI" FontSize="18" Text="{Binding Rate, Mode=TwoWay}" HorizontalAlignment="Stretch" VerticalAlignment="Bottom" x:Name="rate" Grid.Row="1" Grid.RowSpan="2" />
</Grid>
<Grid Grid.Row="1" Grid.Column="4">
<Grid.RowDefinitions>
<RowDefinition Height="17*"/>
<RowDefinition Height="17"/>
<RowDefinition Height="16*"/>
</Grid.RowDefinitions>
<TextBlock HorizontalAlignment="Stretch" Text="{Binding Taxes, Mode=TwoWay}" FontFamily="Segoe UI" FontWeight="Light" FontSize="26" VerticalAlignment="Center" x:Name="taxesTextBlock" Grid.Row="1" Grid.RowSpan="2" Foreground="#FF549BAE"/>
</Grid>
<Grid Grid.Row="2" Grid.RowSpan="2" Grid.Column="4">
<TextBlock HorizontalAlignment="Stretch" FontFamily="Segoe UI" FontWeight="Light" FontSize="32" VerticalAlignment="Center" x:Name="totalAmount" Foreground="#FF549BAE"/>
</Grid>
<Grid Grid.Row="4" Grid.Column="4">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="0.2*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Button Foreground="White" HorizontalAlignment="Stretch" FontFamily="Segoe UI" FontSize="18" VerticalAlignment="Stretch" x:Name="updtButton" Content="Update" Grid.Row="0" Grid.Column="0" Click="updtButton_Click" TabIndex="4" Grid.ColumnSpan="2" Margin="9,0,10,0"/>
<Button Foreground="White" HorizontalAlignment="Stretch" FontFamily="Segoe UI" FontSize="18" VerticalAlignment="Top" x:Name="cancelButton" Content="Cancel" Grid.Row="0" Grid.Column="2" Grid.RowSpan="2" Click="cancelButton_Click" TabIndex="5"/>
</Grid>
<Grid Grid.Row="4" Grid.Column="3">
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
</Grid>
</Grid>
<Grid Background="#FF004051" Opacity="0.7" Grid.Row="2"/>
</Grid>
</Page>

Просмотреть файл

@ -1,356 +0,0 @@
#region Copyright Syncfusion Inc. 2001-2024.
// Copyright Syncfusion Inc. 2001-2024. All rights reserved.
// Use of this code is subject to the terms of our license.
// A copy of the current license can be obtained at any time by e-mailing
// licensing@syncfusion.com. Any infringement will be prosecuted under
// applicable laws.
#endregion
using System;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Media;
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
namespace Invoice
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class Dialog : Page,IDisposable
{
#region Fields
public event EventHandler CloseRequested;
public event EventHandler UpdateRequested;
InvoiceItem m_invoiceItem;
ProductList m_productlist;
const double DefaultTaxInPercent = 7;
bool onInit;
#endregion
#region Constructor
/// <summary>
///
/// </summary>
public Dialog()
: this(null, "Add Item", new ProductList())
{
}
/// <summary>
///
/// </summary>
public Dialog(ProductList productList)
: this(null, "Add Item", productList)
{
}
/// <summary>
///
/// </summary>
/// <param name="newItem"></param>
/// <param name="title"></param>
/// <param name="productList"></param>
public Dialog(InvoiceItem newItem, string title, ProductList productList)
: this(newItem, title, productList, 0)
{
}
/// <summary>
///
/// </summary>
/// <param name="newItem"></param>
/// <param name="title"></param>
public Dialog(InvoiceItem newItem, string title, ProductList productList, int productIndex)
{
this.InitializeComponent();
var bounds = Window.Current.Bounds;
this.Height = bounds.Height;
if (newItem == null)
{
newItem = new InvoiceItem();
newItem.ItemName = productList[0].Name;
newItem.Rate = productList[0].Rate;
}
m_invoiceItem = newItem;
onInit = true;
this.DataContext = m_invoiceItem;
this.Title.Text = title;
double currentRate = m_invoiceItem.Rate;
m_productlist = productList;
this.item.ItemsSource = m_productlist;
this.item.DisplayMemberPath = "Name";
this.item.SelectedItem = m_productlist[productIndex];
if (currentRate != 0)
this.rate.Value = currentRate;
if (!newItem.Taxes.Equals("0"))
{
this.taxesTextBlock.Text = newItem.Taxes.ToString();
}
if (newItem.Rate!=0)
{
this.rate.Value = newItem.Rate;
UpdateTotalAmount();
}
if (newItem.Quantity==0)
{
newItem.Quantity = 1;
this.quantity.Value = 1;
CalculateTax();
UpdateTotalAmount();
}
onInit = false;
}
#endregion
#region Implementation
#region Events
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void cancelButton_Click(object sender, RoutedEventArgs e)
{
if (CloseRequested != null)
CloseRequested(this, EventArgs.Empty);
}
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void updtButton_Click(object sender, RoutedEventArgs e)
{
FieldsUpdateEventArgs args = new FieldsUpdateEventArgs();
args.UpdatedFields = m_invoiceItem;
if (UpdateRequested != null)
{
UpdateRequested(this, args);
}
}
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void item_GotFocus(object sender, RoutedEventArgs e)
{
TextBox textBox = (TextBox)e.OriginalSource;
textBox.SelectAll();
}
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void quantity_TextChanged(object sender, TextChangedEventArgs e)
{
if (onInit)
return;
int value = 0;
if (int.TryParse((string)quantity.Value, out value))
{
CalculateTax();
UpdateTotalAmount();
quantity.BorderBrush = new SolidColorBrush(Windows.UI.Color.FromArgb(255, 0, 64, 81));
}
else
{
quantity.BorderBrush = new SolidColorBrush(Windows.UI.Color.FromArgb(255, 255, 37, 37));
}
}
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void rate_TextChanged(object sender, TextChangedEventArgs e)
{
}
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void item_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (onInit)
return;
Product product = item.SelectedItem as Product;
m_invoiceItem.ItemName = product.Name;
if (!m_invoiceItem.Rate.Equals(product.Rate.ToString()))
{
m_invoiceItem.Rate = product.Rate;
rate.Value = m_invoiceItem.Rate;
CalculateTax();
UpdateTotalAmount();
}
}
#endregion
#region Helper Method
/// <summary>
///
/// </summary>
public void InitializeFocus()
{
this.item.Focus(Windows.UI.Xaml.FocusState.Programmatic);
}
/// <summary>
///
/// </summary>
public Product SelectedProduct
{
set
{
if (value != null)
{
item.SelectedItem = value;
}
}
}
/// <summary>
///
/// </summary>
private void UpdateTotalAmount()
{
int quantityValue = GetQuantityAsInt();
double rateValue = (double)rate.Value;
double calculatedTax = m_invoiceItem.Taxes;
double taxedAmount = (quantityValue * rateValue) + calculatedTax;
this.totalAmount.Text = "$" + taxedAmount.ToString();
}
public int GetQuantityAsInt()
{
int result;
if (int.TryParse(quantity.Value.ToString(), out result))
return result;
return 1;
}
/// <summary>
///
/// </summary>
private void CalculateTax()
{
double currentRate = (double)rate.Value;
int currentQuantity = GetQuantityAsInt();
{
double calculatedTax = 0.0;
calculatedTax = (currentRate * currentQuantity) * (DefaultTaxInPercent / 100);
m_invoiceItem.Taxes = calculatedTax;
taxesTextBlock.Text = "$" + calculatedTax.ToString();
}
}
#endregion
private void quantity_ValueChanged(object sender,Syncfusion.UI.Xaml.Controls.Input.ValueChangedEventArgs e)
{
if (onInit)
return;
if (rate != null)
{
double value = (double) rate.Value;
{
rate.BorderBrush = new SolidColorBrush(Windows.UI.Color.FromArgb(255, 0, 64, 81));
CalculateTax();
UpdateTotalAmount();
}
}
}
#region Implementation
/// <summary>
/// Releases unmanaged and - optionally - managed resources.
/// </summary>
public void Dispose()
{
UnlinkChildrens(this);
this.Resources.Clear();
Loaded -= cancelButton_Click;
Loaded -= updtButton_Click;
m_invoiceItem = null;
m_productlist = null;
}
/// <summary>
/// Unlink the child elements from the page.
/// </summary>
/// <param name="element"></param>
void UnlinkChildrens(UIElement element)
{
if (element == null)
return;
if (element is Panel)
{
for (int i = 0; i < (element as Panel).Children.Count; i++)
{
UIElement childElement = (element as Panel).Children[i];
UnlinkChildrens(childElement);
(element as Panel).Children.Remove(childElement);
i--;
}
}
else if (element is ItemsControl)
{
for (int j = 0; j < (element as ItemsControl).Items.Count; j++)
{
UIElement childElement = ((element as ItemsControl).Items[j] as UIElement);
if (childElement == null)
{
//(element as ItemsControl).Items.RemoveAt(j);
//j--;
}
else
{
UnlinkChildrens(childElement);
(element as ItemsControl).Items.Remove(childElement);
j--;
}
}
}
else if (element is ContentControl)
{
UnlinkChildrens((element as ContentControl).Content as UIElement);
(element as ContentControl).Content = null;
}
else if (element is UserControl)
{
UnlinkChildrens((element as UserControl).Content as UIElement);
(element as UserControl).Content = null;
}
}
#endregion
#endregion
}
/// <summary>
///
/// </summary>
public class FieldsUpdateEventArgs : EventArgs,IDisposable
{
private InvoiceItem m_invoiceItem;
public InvoiceItem UpdatedFields
{
get
{
return m_invoiceItem;
}
set
{
m_invoiceItem = value;
}
}
public void Dispose()
{
m_invoiceItem = null;
}
}
}

Просмотреть файл

@ -1,102 +0,0 @@
#region Copyright Syncfusion Inc. 2001-2024.
// Copyright Syncfusion Inc. 2001-2024. All rights reserved.
// Use of this code is subject to the terms of our license.
// A copy of the current license can be obtained at any time by e-mailing
// licensing@syncfusion.com. Any infringement will be prosecuted under
// applicable laws.
#endregion
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Invoice
{
public class InvoiceItem
{
private string _item;
private int _quantity;
private double _rate;
private double _taxes;
private double _totalAmount;
#region Properties
//public string ItemID
//{
// get
// {
// return _itemID.ToString();
// }
// set
// {
// _itemID = Convert.ToInt32(value);
// }
//}
public string ItemName
{
get
{
return _item;
}
set
{
_item=value;
}
}
public int Quantity
{
get
{
return _quantity;
}
set
{
_quantity = value;
UpdateTotalAmount();
}
}
public double Rate
{
get
{
return _rate;
}
set
{
_rate = value;
UpdateTotalAmount();
}
}
public double Taxes
{
get
{
return _taxes;
}
set
{
_taxes = value;
UpdateTotalAmount();
}
}
public double TotalAmount
{
get
{
return _totalAmount;
}
set
{
_totalAmount = value;
}
}
#endregion
void UpdateTotalAmount()
{
TotalAmount = (_quantity * _rate + _taxes);
}
}
}

Просмотреть файл

@ -1,309 +0,0 @@
<Page
x:Class="Invoice.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Invoice"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Foreground="White">
<Page.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="ms-appx:///DocIO/Invoice/Common/IOStandardStyles.Xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Page.Resources>
<Page.BottomAppBar>
<AppBar Background="#087196" BorderBrush="#087196" x:Name="BottomAppBar1" Padding="10,5,10,5" AutomationProperties.Name="Bottom App Bar">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid Grid.Column="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="4*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Button Grid.Column="1" x:Name="PDFExport" Style="{StaticResource PDFExportAppBarButtonStyle}" Click="PDFExport_Click" Tag="Export To PDF"/>
<Button Grid.Column="2" x:Name="WordExport" Style="{StaticResource WordExportAppBarButtonStyle}" Click="WordExport_Click" Tag="Export To Word"/>
<Button Grid.Column="3" x:Name="ExcelExport" Style="{StaticResource ExcelExportAppBarButtonStyle}" Click="ExcelExport_Click" Tag="Export To Excel"/>
</Grid>
</Grid>
</AppBar>
</Page.BottomAppBar>
<Grid x:Name="root">
<Grid x:Name="MainGrid">
<Grid.RowDefinitions>
<RowDefinition Height="0.25*"/>
<RowDefinition Height="2*"/>
</Grid.RowDefinitions>
<!-- Back button and page title -->
<Grid x:Name = "Header" Background="#087196">
<Grid.RowDefinitions>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.075*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid Grid.Column="1" >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="4*"></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="0.2*"></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="0.2*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBlock Style="{StaticResource HeaderTextStyle}" x:Name="pageTitle" VerticalAlignment="Center" Text="Invoice" FontSize="56" FontFamily="Segoe UI" FontWeight="Light"/>
<Button Style="{StaticResource ExportButtonStyle}" Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Center" Click="Export"/>
</Grid>
</Grid>
<Grid x:Name="ContentGrid" Grid.Row="1" Background="White">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.2*"/>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="0.2*"/>
</Grid.ColumnDefinitions>
<Grid x:Name = "Layer1" Grid.Column="1">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="0.05*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid x:Name = "Level1" Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid Grid.Column="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="5*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="0.4*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="0.2*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Image Grid.Row="1" x:Name="CompanyLogo" HorizontalAlignment="Stretch" VerticalAlignment="Center" Grid.Column="0" Source="Assets/Syncfusion.PNG" />
<TextBlock Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" x:Name = "Address" FontSize="15" Foreground="#404435" FontWeight="Light">
2501 Aerial Center Parkway,<LineBreak/>Suite 200 Morrisville,<LineBreak/>NC 27560 USA,<LineBreak/>Tel +1 888.936.8638 <LineBreak/>Fax +1 919.573.0306
</TextBlock>
</Grid>
<Grid Grid.Column="2" Grid.ColumnSpan="2" >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="4*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Rectangle Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Grid.RowSpan="2" StrokeThickness="1" StrokeDashArray="4,4" Stroke="#FFCECECE"></Rectangle>
<Border Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Grid.RowSpan="3" >
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.1*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="0.2*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Button Style="{ StaticResource EditButtonStyle}" VerticalAlignment="Top" Padding="0" HorizontalAlignment="Right" Grid.Column="2" Click="EditBillingDetails">
<Image Source="Assets/Edit.jpg"/>
</Button>
<Grid Grid.Column="1" Grid.Row="0" Grid.RowSpan="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="3*"></ColumnDefinition>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0" >
<TextBlock x:Name = "BILLTO" Text = "BILL TO" FontSize="18" Foreground="#404435" FontWeight="Light" Padding="0,20,0,0"/>
<TextBlock x:Name = "NameTextBlock" FontSize="18" Foreground="#808285" Padding="0,5,0,0"/>
<TextBlock x:Name = "BillingAddress" TextWrapping="Wrap" FontSize="18" Foreground="#808285"/>
</StackPanel>
</Grid>
<Grid Grid.Column="2" Grid.RowSpan="2" Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="3*"></ColumnDefinition>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid Grid.Column="0" >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Text = "DATE: " FontWeight="Light" FontSize="18" Foreground="#404435" Padding="0,20,0,0"/>
<TextBlock Grid.Column="1" x:Name = "DATE" FontSize="18" Foreground="#808285" Padding="5,20,0,0"/>
</Grid>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Text = "INVOICE NO: " FontWeight="Light" FontSize="18" Foreground="#404435" Padding="0,10,0,0"/>
<TextBlock Grid.Column="1" x:Name = "InvoiceNumber" FontSize="18" Foreground="#808285" Padding="5,10,0,0"/>
</Grid>
<Grid Grid.Row="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Text = "DUE DATE: " FontWeight="Light" FontSize="18" Foreground="#404435" Padding="0,0,0,0"/>
<TextBlock Grid.Column="1" x:Name = "DueDate" FontSize="18" Foreground="#808285" Padding="5,0,0,0"/>
</Grid>
</Grid>
</Grid>
</Grid>
</Border>
</Grid>
</Grid>
<Grid Grid.Row="1" Name="InvoiceGridHeader">
<Grid.RowDefinitions>
<RowDefinition Height="40"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="2*"/>
</Grid.ColumnDefinitions>
<StackPanel Background="#B3D1E8" Grid.Column="0">
<Grid Height="40">
<TextBlock Padding="10,0,0,0" x:Name="Item" Text="Item" HorizontalAlignment="Stretch" TextAlignment="Left" VerticalAlignment="Center" FontWeight="Normal" FontFamily="Segoe UI" Foreground="#3F3F3F" FontSize="18"/>
</Grid>
</StackPanel>
<StackPanel Background="#B3D1E8" Grid.Column="1">
<Grid Height="40">
<TextBlock x:Name="Quantity" Text="Quantity" Padding="0,0,20,0" TextAlignment="Right" HorizontalAlignment="Stretch" FontWeight="Normal" FontFamily="Segoe UI" Foreground="#3F3F3F" FontSize="18" VerticalAlignment="Center"/>
</Grid>
</StackPanel>
<StackPanel Background="#B3D1E8" Grid.Column="2">
<Grid Height="40">
<TextBlock x:Name="Rate" Text="Rate" Padding="0,0,15,0" TextAlignment="Right" HorizontalAlignment="Stretch" FontWeight="Normal" FontFamily="Segoe UI" Foreground="#3F3F3F" FontSize="18" VerticalAlignment="Center"/>
</Grid>
</StackPanel>
<StackPanel Background="#B3D1E8" Grid.Column="3">
<Grid Height="40">
<TextBlock x:Name="Taxes" Text="Taxes" Padding="0,0,15,0" TextAlignment="Right" HorizontalAlignment="Stretch" FontWeight="Normal" FontFamily="Segoe UI" Foreground="#3F3F3F" FontSize="18" VerticalAlignment="Center"/>
</Grid>
</StackPanel>
<StackPanel VerticalAlignment="Stretch" Background="#B3D1E8" Grid.Column="4">
<Grid Height="40">
<TextBlock x:Name="Amount" Text="Amount" Padding="0,0,15,0" TextAlignment="Right" HorizontalAlignment="Stretch" FontWeight="Normal" VerticalAlignment="Center" FontFamily="Segoe UI" Foreground="#3F3F3F" FontSize="18"/>
</Grid>
</StackPanel>
</Grid>
<ScrollViewer x:Name="GridScrollViewer" Grid.Row="2" Height="{Binding InvoiceGrid.ActualHeight}" VerticalScrollBarVisibility="Auto" BorderBrush="AliceBlue">
<Grid Name="InvoiceGrid" Tapped="InvoiceGrid_Tapped" DoubleTapped="InvoiceGrid_DoubleTapped">
<Grid.RowDefinitions>
<RowDefinition Height="30"/>
<RowDefinition Height="30"/>
<RowDefinition Height="30"/>
<RowDefinition Height="30"/>
<RowDefinition Height="30"/>
<RowDefinition Height="30"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="2*"/>
</Grid.ColumnDefinitions>
<Rectangle Grid.Row="0" Height="1" StrokeThickness="0.75" VerticalAlignment="Bottom" Grid.ColumnSpan="5" StrokeDashArray="4,4" Stroke="#FFCECECE"></Rectangle>
<Rectangle Grid.Row="1" Height="1" StrokeThickness="0.75" VerticalAlignment="Bottom" Grid.ColumnSpan="5" StrokeDashArray="4,4" Stroke="#FFCECECE"></Rectangle>
<Rectangle Grid.Row="2" Height="1" StrokeThickness="0.75" VerticalAlignment="Bottom" Grid.ColumnSpan="5" StrokeDashArray="4,4" Stroke="#FFCECECE"></Rectangle>
<Rectangle Grid.Row="3" Height="1" StrokeThickness="0.75" VerticalAlignment="Bottom" Grid.ColumnSpan="5" StrokeDashArray="4,4" Stroke="#FFCECECE"></Rectangle>
<Rectangle Grid.Row="4" Height="1" StrokeThickness="0.75" VerticalAlignment="Bottom" Grid.ColumnSpan="5" StrokeDashArray="4,4" Stroke="#FFCECECE"></Rectangle>
<Rectangle Grid.Row="5" Height="1" StrokeThickness="0.75" VerticalAlignment="Bottom" Grid.ColumnSpan="5" StrokeDashArray="4,4" Stroke="#FFCECECE"></Rectangle>
</Grid>
</ScrollViewer>
<Grid x:Name="Events" Grid.Row="4">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid Grid.Column="0" Grid.ColumnSpan="2" >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="2*"/>
</Grid.ColumnDefinitions>
<Button Grid.Column="0" FontWeight="Normal" Style="{StaticResource AddItemStyle}" Width="120" Height="40" HorizontalAlignment="Left" VerticalAlignment="Top" x:Name="AddButton" Content="Add Item" Click="Add" FontSize="16"/>
<Button Grid.Column="1" FontWeight="Normal" IsEnabled="False" Style="{StaticResource RemoveItemStyle}" Width="120" Height="40" HorizontalAlignment="Left" VerticalAlignment="Top" x:Name="DeleteButton" Content="Delete Item" Click="Delete" FontSize="16"/>
</Grid>
<Grid Grid.Column="3" Grid.ColumnSpan="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="0.3*"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TextBlock Grid.Row="1" Padding="0,0,10,20" VerticalAlignment="Center" HorizontalAlignment="Right" Text="Total Due:" Foreground="#404435" FontSize="18"/>
<TextBlock Grid.Row="1" Padding="0,0,0,20" Grid.Column="1" x:Name="TotalAmount" TextWrapping="Wrap" HorizontalAlignment="Stretch" TextAlignment="Center" Foreground="#404435" FontSize="42" VerticalAlignment="Center"/>
</Grid>
</Grid>
</Grid>
</Grid>
</Grid>
<Grid HorizontalAlignment="Center" VerticalAlignment="Center"
Background="#087196" x:Name="progress" Visibility="Collapsed">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition />
</Grid.ColumnDefinitions>
<ProgressRing Width="30" Height="30" Foreground="White" IsActive="True" Margin="15"
VerticalAlignment="Center"/>
<TextBlock Text="Generating invoice" Foreground="White" Margin="15"
VerticalAlignment="Center" FontSize="18" Grid.Column="1"/>
</Grid>
</Grid>
</Page>

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше