v17.1.0.38
|
@ -0,0 +1,19 @@
|
|||
Any raw assets you want to be deployed with your application can be placed in
|
||||
this directory (and child directories) and given a Build Action of "AndroidAsset".
|
||||
|
||||
These files will be deployed with you package and will be accessible using Android's
|
||||
AssetManager, like this:
|
||||
|
||||
public class ReadAsset : Activity
|
||||
{
|
||||
protected override void OnCreate (Bundle bundle)
|
||||
{
|
||||
base.OnCreate (bundle);
|
||||
|
||||
InputStream input = Assets.Open ("my_asset.txt");
|
||||
}
|
||||
}
|
||||
|
||||
Additionally, some Android functions will automatically load asset files:
|
||||
|
||||
Typeface tf = Typeface.CreateFromAsset (Context.Assets, "fonts/samplefont.ttf");
|
|
@ -0,0 +1,37 @@
|
|||
#region Copyright Syncfusion Inc. 2001-2019.
|
||||
// Copyright Syncfusion Inc. 2001-2019. 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 Android.App;
|
||||
using Android.Content.PM;
|
||||
using Android.Runtime;
|
||||
using Android.Views;
|
||||
using Android.Widget;
|
||||
using Android.OS;
|
||||
|
||||
namespace SampleBrowser.DocIO.Droid
|
||||
{
|
||||
[Activity(Label = "SampleBrowser DocIO", MainLauncher = false, Icon = "@drawable/AppIcon", Theme = "@style/MainTheme", ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
|
||||
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
|
||||
{
|
||||
internal static MainActivity MainPageActivity;
|
||||
protected override void OnCreate(Bundle bundle)
|
||||
{
|
||||
TabLayoutResource = Resource.Layout.Tabbar;
|
||||
ToolbarResource = Resource.Layout.Toolbar;
|
||||
|
||||
base.OnCreate(bundle);
|
||||
MainPageActivity = this;
|
||||
|
||||
global::Xamarin.Forms.Forms.Init(this, bundle);
|
||||
Core.Droid.CoreSampleBrowser.Init(Resources, this);
|
||||
LoadApplication(new App());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.syncfusion.samplebrowser.docio">
|
||||
<uses-sdk android:minSdkVersion="16" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<application android:label="DocIO Sample">
|
||||
<provider android:name="android.support.v4.content.FileProvider"
|
||||
android:authorities="${applicationId}.provider"
|
||||
android:exported="false"
|
||||
android:grantUriPermissions="true">
|
||||
<meta-data android:name="android.support.FILE_PROVIDER_PATHS"
|
||||
android:resource="@xml/provider_paths" />
|
||||
</provider>
|
||||
</application>
|
||||
</manifest>
|
|
@ -0,0 +1,41 @@
|
|||
#region Copyright Syncfusion Inc. 2001-2019.
|
||||
// Copyright Syncfusion Inc. 2001-2019. 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.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using Android.App;
|
||||
using Xamarin.Forms.Internals;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("SampleBrowser.DocIO.Droid")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Syncfusion Inc.")]
|
||||
[assembly: AssemblyProduct("SampleBrowser.DocIO.Droid")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2001-2019 Syncfusion Inc.")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
[assembly: ComVisible(false)]
|
||||
[assembly:Preserve]
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
|
||||
// Add some common permissions, these can be removed if not needed
|
||||
[assembly: UsesPermission(Android.Manifest.Permission.Internet)]
|
||||
[assembly: UsesPermission(Android.Manifest.Permission.WriteExternalStorage)]
|
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.design.widget.TabLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/sliding_tabs"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/colorPrimary"
|
||||
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
|
||||
app:tabIndicatorColor="@android:color/white"
|
||||
app:tabGravity="fill"
|
||||
app:tabMode="fixed" />
|
|
@ -0,0 +1,9 @@
|
|||
<android.support.v7.widget.Toolbar
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/colorPrimary"
|
||||
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
|
||||
android:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<resources>
|
||||
|
||||
<style name="MainTheme" parent="MainTheme.Base">
|
||||
</style>
|
||||
<!-- Base theme applied no matter what API -->
|
||||
<style name="MainTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar">
|
||||
<!--If you are using revision 22.1 please use just windowNoTitle. Without android:-->
|
||||
<item name="windowNoTitle">true</item>
|
||||
<!--We will be using the toolbar so no need to show ActionBar-->
|
||||
<item name="windowActionBar">false</item>
|
||||
<!-- Set theme colors from http://www.google.com/design/spec/style/color.html#color-color-palette -->
|
||||
<!-- colorPrimary is used for the default action bar background -->
|
||||
<item name="colorPrimary">#2196F3</item>
|
||||
<!-- colorPrimaryDark is used for the status bar -->
|
||||
<item name="colorPrimaryDark">#1976D2</item>
|
||||
<!-- colorAccent is used as the default value for colorControlActivated
|
||||
which is used to tint widgets -->
|
||||
<item name="colorAccent">#FF4081</item>
|
||||
<!-- You can also set colorControlNormal, colorControlActivated
|
||||
colorControlHighlight and colorSwitchThumbNormal. -->
|
||||
<item name="windowActionModeOverlay">true</item>
|
||||
|
||||
<item name="android:datePickerDialogTheme">@style/AppCompatDialogStyle</item>
|
||||
</style>
|
||||
|
||||
<style name="AppCompatDialogStyle" parent="Theme.AppCompat.Light.Dialog">
|
||||
<item name="colorAccent">#FF4081</item>
|
||||
</style>
|
||||
</resources>
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<paths xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<external-path name="external_files" path="."/>
|
||||
</paths>
|
|
@ -0,0 +1,87 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{DEC3BC88-6A26-4282-BF1B-0D5989F58CB1}</ProjectGuid>
|
||||
<ProjectTypeGuids>{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<OutputType>Library</OutputType>
|
||||
<RootNamespace>SampleBrowser.DocIO.Droid</RootNamespace>
|
||||
<AssemblyName>SampleBrowser.DocIO.Android</AssemblyName>
|
||||
<TargetFrameworkVersion>v8.0</TargetFrameworkVersion>
|
||||
<AndroidApplication>True</AndroidApplication>
|
||||
<AndroidResgenFile>Resources\Resource.designer.cs</AndroidResgenFile>
|
||||
<AndroidResgenClass>Resource</AndroidResgenClass>
|
||||
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
|
||||
<MonoAndroidResourcePrefix>Resources</MonoAndroidResourcePrefix>
|
||||
<MonoAndroidAssetsPrefix>Assets</MonoAndroidAssetsPrefix>
|
||||
<AndroidUseLatestPlatformSdk>true</AndroidUseLatestPlatformSdk>
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug</OutputPath>
|
||||
<DefineConstants>DEBUG;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AndroidLinkMode>None</AndroidLinkMode>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AndroidManagedSymbols>true</AndroidManagedSymbols>
|
||||
<AndroidUseSharedRuntime>false</AndroidUseSharedRuntime>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="MainActivity.cs" />
|
||||
<Compile Include="Resources\Resource.Designer.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="SaveAndroid.cs" />
|
||||
<Compile Include="SplashScreenActivity.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Resources\AboutResources.txt" />
|
||||
<None Include="Assets\AboutAssets.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Properties\AndroidManifest.xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\layout\Tabbar.axml" />
|
||||
<AndroidResource Include="Resources\layout\Toolbar.axml" />
|
||||
<AndroidResource Include="Resources\values\styles.xml" />
|
||||
<AndroidResource Include="Resources\xml\provider_paths.xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="SampleBrowser.Core" Version="17.1.0.38" />
|
||||
<PackageReference Include="Syncfusion.Xamarin.Core" Version="17.1.0.38" />
|
||||
<PackageReference Include="Syncfusion.Xamarin.DataSource" Version="17.1.0.38" />
|
||||
<PackageReference Include="Syncfusion.Xamarin.GridCommon" Version="17.1.0.38" />
|
||||
<PackageReference Include="Syncfusion.Xamarin.SfListView" Version="17.1.0.38" />
|
||||
<Reference Include="Mono.Android.Export" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="Mono.Android" />
|
||||
<PackageReference Include="Xamarin.Forms" Version="3.2.0.871581" />
|
||||
<PackageReference Include="Xamarin.Android.Support.Design" Version="27.0.2" />
|
||||
<PackageReference Include="Xamarin.Android.Support.v7.AppCompat" Version="27.0.2" />
|
||||
<PackageReference Include="Xamarin.Android.Support.v4" Version="27.0.2" />
|
||||
<PackageReference Include="Xamarin.Android.Support.v7.CardView" Version="27.0.2" />
|
||||
<PackageReference Include="Xamarin.Android.Support.v7.MediaRouter" Version="27.0.2" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\DocIO\SampleBrowser.DocIO.csproj">
|
||||
<Project>{EB5CBDB6-C051-446B-BDDF-A00B0F1829D1}</Project>
|
||||
<Name>SampleBrowser.DocIO</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
|
||||
</Project>
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Compile Include="$(MSBuildThisFileDirectory)\SaveAndroid.cs">
|
||||
<Link>DocIO\SaveAndroid.cs</Link>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -0,0 +1,116 @@
|
|||
#region Copyright Syncfusion Inc. 2001 - 2019
|
||||
// Copyright Syncfusion Inc. 2001 - 2019. 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.IO;
|
||||
using Android.Content;
|
||||
using Java.IO;
|
||||
using Xamarin.Forms;
|
||||
using System.Threading.Tasks;
|
||||
using SampleBrowser.DocIO.Droid;
|
||||
using SampleBrowser.Core;
|
||||
using Android.Support.V4.Content;
|
||||
|
||||
[assembly: Dependency(typeof(SaveAndroid))]
|
||||
[assembly: Dependency(typeof(MailService))]
|
||||
namespace SampleBrowser.DocIO.Droid
|
||||
{
|
||||
class SaveAndroid : ISave
|
||||
{
|
||||
public void Save(string fileName, String contentType, MemoryStream stream)
|
||||
{
|
||||
string exception = string.Empty;
|
||||
string root = null;
|
||||
if (Android.OS.Environment.IsExternalStorageEmulated)
|
||||
{
|
||||
root = Android.OS.Environment.ExternalStorageDirectory.ToString();
|
||||
}
|
||||
else
|
||||
root = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
|
||||
|
||||
Java.IO.File myDir = new Java.IO.File(root + "/Syncfusion");
|
||||
myDir.Mkdir();
|
||||
|
||||
Java.IO.File file = new Java.IO.File(myDir, fileName);
|
||||
|
||||
if (file.Exists()) file.Delete();
|
||||
|
||||
try
|
||||
{
|
||||
FileOutputStream outs = new FileOutputStream(file);
|
||||
outs.Write(stream.ToArray());
|
||||
|
||||
outs.Flush();
|
||||
outs.Close();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
exception = e.ToString();
|
||||
}
|
||||
if (file.Exists() && contentType != "application/html")
|
||||
{
|
||||
Android.Net.Uri path = Android.Net.Uri.FromFile(file);
|
||||
string extension = Android.Webkit.MimeTypeMap.GetFileExtensionFromUrl(Android.Net.Uri.FromFile(file).ToString());
|
||||
string mimeType = Android.Webkit.MimeTypeMap.Singleton.GetMimeTypeFromExtension(extension);
|
||||
Intent intent = new Intent(Intent.ActionView);
|
||||
intent.SetFlags(ActivityFlags.ClearTop | ActivityFlags.NewTask);
|
||||
path = FileProvider.GetUriForFile(Forms.Context, Android.App.Application.Context.PackageName + ".provider", file);
|
||||
intent.SetDataAndType(path, mimeType);
|
||||
intent.AddFlags(ActivityFlags.GrantReadUriPermission);
|
||||
Forms.Context.StartActivity(Intent.CreateChooser(intent, "Choose App"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class MailService : IMailService
|
||||
{
|
||||
public MailService()
|
||||
{
|
||||
}
|
||||
public void ComposeMail(string fileName, string[] recipients, string subject, string messagebody, MemoryStream filestream)
|
||||
{
|
||||
string exception = string.Empty;
|
||||
string root = null;
|
||||
if (Android.OS.Environment.IsExternalStorageEmulated)
|
||||
{
|
||||
root = Android.OS.Environment.ExternalStorageDirectory.ToString();
|
||||
}
|
||||
else
|
||||
root = System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments);
|
||||
|
||||
Java.IO.File myDir = new Java.IO.File(root + "/Syncfusion");
|
||||
myDir.Mkdir();
|
||||
|
||||
Java.IO.File file = new Java.IO.File(myDir, fileName);
|
||||
|
||||
if (file.Exists()) file.Delete();
|
||||
|
||||
try
|
||||
{
|
||||
FileOutputStream outs = new FileOutputStream(file);
|
||||
outs.Write(filestream.ToArray());
|
||||
|
||||
outs.Flush();
|
||||
outs.Close();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
exception = e.ToString();
|
||||
}
|
||||
|
||||
Intent email = new Intent(Android.Content.Intent.ActionSend);
|
||||
var uri = Android.Net.Uri.Parse("file:///" + file.AbsolutePath);
|
||||
|
||||
//file.SetReadable(true, true);
|
||||
email.PutExtra(Android.Content.Intent.ExtraSubject, subject);
|
||||
email.PutExtra(Intent.ExtraStream, uri);
|
||||
email.SetType("application/pdf");
|
||||
|
||||
//MainActivity.MainPageActivity.StartActivity(email);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
#region Copyright Syncfusion Inc. 2001-2019.
|
||||
// Copyright Syncfusion Inc. 2001-2019. 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 Android.App;
|
||||
|
||||
namespace SampleBrowser.DocIO.Droid
|
||||
{
|
||||
[Activity(Theme = "@style/Theme.Splash",
|
||||
MainLauncher = true,
|
||||
NoHistory = true, Icon = "@drawable/AppIcon")]
|
||||
public class SplashScreenActivity : SampleBrowser.Core.Android.SplashScreenActivity
|
||||
{
|
||||
protected override Type GetMainActivityType()
|
||||
{
|
||||
return typeof(MainActivity);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
<Application
|
||||
x:Class="SampleBrowser.DocIO.UWP.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:SampleBrowser.DocIO.UWP"
|
||||
RequestedTheme="Light">
|
||||
</Application>
|
|
@ -0,0 +1,121 @@
|
|||
#region Copyright Syncfusion Inc. 2001-2019.
|
||||
// Copyright Syncfusion Inc. 2001-2019. 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 System.Reflection;
|
||||
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 SampleBrowser.DocIO.UWP
|
||||
{
|
||||
/// <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 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)
|
||||
{
|
||||
List<Assembly> assembliesToInclude = new List<Assembly>();
|
||||
assembliesToInclude.Add(typeof(GettingStartedDocIO).GetTypeInfo().Assembly);
|
||||
assembliesToInclude.Add(typeof(Core.UWP.CoreSampleBrowser).GetTypeInfo().Assembly);
|
||||
assembliesToInclude.Add(Assembly.Load(new AssemblyName("Syncfusion.SfListView.XForms.UWP")));
|
||||
assembliesToInclude.Add(Assembly.Load(new AssemblyName("Syncfusion.GridCommon.Portable")));
|
||||
assembliesToInclude.Add(Assembly.Load(new AssemblyName("Syncfusion.DataSource.Portable")));
|
||||
assembliesToInclude.Add(Assembly.Load(new AssemblyName("Syncfusion.Core.XForms")));
|
||||
assembliesToInclude.Add(Assembly.Load(new AssemblyName("Syncfusion.Compression.Portable")));
|
||||
assembliesToInclude.Add(Assembly.Load(new AssemblyName("Syncfusion.DocIO.Portable")));
|
||||
assembliesToInclude.Add(Assembly.Load(new AssemblyName("Syncfusion.OfficeChart.Portable")));
|
||||
|
||||
Xamarin.Forms.Forms.Init(e, assembliesToInclude);
|
||||
|
||||
|
||||
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;
|
||||
|
||||
Xamarin.Forms.Forms.Init(e);
|
||||
|
||||
if (e.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
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
<forms:WindowsPage
|
||||
x:Class="SampleBrowser.DocIO.UWP.MainPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:forms="using:Xamarin.Forms.Platform.UWP"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:SampleBrowser.DocIO.UWP"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d"
|
||||
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
|
||||
|
||||
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
|
||||
|
||||
</Grid>
|
||||
</forms:WindowsPage>
|
|
@ -0,0 +1,34 @@
|
|||
#region Copyright Syncfusion Inc. 2001-2019.
|
||||
// Copyright Syncfusion Inc. 2001-2019. 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 System.Runtime.InteropServices.WindowsRuntime;
|
||||
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 SampleBrowser.DocIO.UWP
|
||||
{
|
||||
public sealed partial class MainPage
|
||||
{
|
||||
public MainPage()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
|
||||
LoadApplication(new SampleBrowser.DocIO.App());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" IgnorableNamespaces="uap mp">
|
||||
<Identity Name="ec0cc741-fd3e-485c-81be-68815c480690" Publisher="CN=syncfusion" Version="1.0.0.0" />
|
||||
<mp:PhoneIdentity PhoneProductId="ec0cc741-fd3e-485c-81be-68815c480690" PhonePublisherId="00000000-0000-0000-0000-000000000000" />
|
||||
<Properties>
|
||||
<DisplayName>DocIO Sample</DisplayName>
|
||||
<PublisherDisplayName>Syncfusion</PublisherDisplayName>
|
||||
<Logo>SampleBrowser.Core.UWP\Assets\StoreLogo.png</Logo>
|
||||
</Properties>
|
||||
<Dependencies>
|
||||
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.0.0" MaxVersionTested="10.0.0.0" />
|
||||
</Dependencies>
|
||||
<Resources>
|
||||
<Resource Language="x-generate" />
|
||||
</Resources>
|
||||
<Applications>
|
||||
<Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="SampleBrowser.DocIO.UWP.App">
|
||||
<uap:VisualElements DisplayName="DocIO Sample" Square150x150Logo="SampleBrowser.Core.UWP\Assets\Square150x150Logo.png" Square44x44Logo="SampleBrowser.Core.UWP\Assets\Square44x44Logo.png" Description="SampleBrowser.DocIO.UWP" BackgroundColor="transparent">
|
||||
<uap:DefaultTile Wide310x150Logo="SampleBrowser.Core.UWP\Assets\Wide310x150Logo.png">
|
||||
</uap:DefaultTile>
|
||||
<uap:SplashScreen Image="SampleBrowser.Core.UWP\Assets\SplashScreen.png" BackgroundColor="blue" />
|
||||
</uap:VisualElements>
|
||||
</Application>
|
||||
</Applications>
|
||||
<Capabilities>
|
||||
<Capability Name="internetClient" />
|
||||
</Capabilities>
|
||||
</Package>
|
|
@ -0,0 +1,36 @@
|
|||
#region Copyright Syncfusion Inc. 2001-2019.
|
||||
// Copyright Syncfusion Inc. 2001-2019. 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.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("SampleBrowser.DocIO.UWP")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Syncfusion Inc.")]
|
||||
[assembly: AssemblyProduct("SampleBrowser.DocIO.UWP")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2001-2019 Syncfusion Inc.")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
[assembly: ComVisible(false)]
|
|
@ -0,0 +1,31 @@
|
|||
<!--
|
||||
This file contains Runtime Directives used by .NET Native. The defaults here are suitable for most
|
||||
developers. However, you can modify these parameters to modify the behavior of the .NET Native
|
||||
optimizer.
|
||||
|
||||
Runtime Directives are documented at http://go.microsoft.com/fwlink/?LinkID=391919
|
||||
|
||||
To fully enable reflection for App1.MyClass and all of its public/private members
|
||||
<Type Name="App1.MyClass" Dynamic="Required All"/>
|
||||
|
||||
To enable dynamic creation of the specific instantiation of AppClass<T> over System.Int32
|
||||
<TypeInstantiation Name="App1.AppClass" Arguments="System.Int32" Activate="Required Public" />
|
||||
|
||||
Using the Namespace directive to apply reflection policy to all the types in a particular namespace
|
||||
<Namespace Name="DataClasses.ViewModels" Seralize="All" />
|
||||
-->
|
||||
|
||||
<Directives xmlns="http://schemas.microsoft.com/netfx/2013/01/metadata">
|
||||
<Application>
|
||||
<!--
|
||||
An Assembly element with Name="*Application*" applies to all assemblies in
|
||||
the application package. The asterisks are not wildcards.
|
||||
-->
|
||||
<Assembly Name="*Application*" Dynamic="Required All" />
|
||||
|
||||
|
||||
<!-- Add your application specific runtime directives here. -->
|
||||
|
||||
|
||||
</Application>
|
||||
</Directives>
|
|
@ -0,0 +1,141 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
|
||||
<ProjectGuid>{C6469FB2-9CF4-453E-9ADF-0ACBC386A113}</ProjectGuid>
|
||||
<OutputType>AppContainerExe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>SampleBrowser.DocIO.UWP</RootNamespace>
|
||||
<AssemblyName>SampleBrowser.DocIO.UWP</AssemblyName>
|
||||
<DefaultLanguage>en-US</DefaultLanguage>
|
||||
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
|
||||
<TargetPlatformVersion>10.0.16299.0</TargetPlatformVersion>
|
||||
<TargetPlatformMinVersion>10.0.16299.0</TargetPlatformMinVersion>
|
||||
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
|
||||
<EnableDotNetNativeCompatibleProfile>true</EnableDotNetNativeCompatibleProfile>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<PackageCertificateKeyFile>SampleBrowser.DocIO.UWP_TemporaryKey.pfx</PackageCertificateKeyFile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|ARM'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\ARM\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
|
||||
<NoWarn>;2008</NoWarn>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>ARM</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|ARM'">
|
||||
<OutputPath>bin\ARM\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<NoWarn>;2008</NoWarn>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>ARM</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\x64\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
|
||||
<NoWarn>;2008</NoWarn>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
||||
<OutputPath>bin\x64\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<NoWarn>;2008</NoWarn>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\x86\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
|
||||
<NoWarn>;2008</NoWarn>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
|
||||
<OutputPath>bin\x86\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<NoWarn>;2008</NoWarn>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<None Include="SampleBrowser.DocIO.UWP_TemporaryKey.pfx" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="App.xaml.cs">
|
||||
<DependentUpon>App.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="MainPage.xaml.cs">
|
||||
<DependentUpon>MainPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="SaveWindows.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AppxManifest Include="Package.appxmanifest">
|
||||
<SubType>Designer</SubType>
|
||||
</AppxManifest>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Properties\Default.rd.xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ApplicationDefinition Include="App.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
<Page Include="MainPage.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Xamarin.Forms" Version="3.2.0.871581" />
|
||||
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform" Version="6.0.8"/>
|
||||
<PackageReference Include="SampleBrowser.Core" Version="17.1.0.38" />
|
||||
<PackageReference Include="Syncfusion.Xamarin.Core" Version="17.1.0.38" />
|
||||
<PackageReference Include="Syncfusion.Xamarin.DataSource" Version="17.1.0.38" />
|
||||
<PackageReference Include="Syncfusion.Xamarin.GridCommon" Version="17.1.0.38" />
|
||||
<PackageReference Include="Syncfusion.Xamarin.SfListView" Version="17.1.0.38" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\DocIO\SampleBrowser.DocIO.csproj">
|
||||
<Project>{EB5CBDB6-C051-446B-BDDF-A00B0F1829D1}</Project>
|
||||
<Name>SampleBrowser.DocIO</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' < '14.0' ">
|
||||
<VisualStudioVersion>14.0</VisualStudioVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
|
||||
</Project>
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Compile Include="$(MSBuildThisFileDirectory)\SaveWindows.cs" >
|
||||
<Link>DocIO\SaveWindows.cs</Link>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -0,0 +1,124 @@
|
|||
#region Copyright Syncfusion Inc. 2001-2016.
|
||||
// Copyright Syncfusion Inc. 2001-2016. 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 System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Xamarin.Forms;
|
||||
using Windows.Storage;
|
||||
using Windows.Storage.Pickers;
|
||||
using SampleBrowser;
|
||||
using SampleBrowser.DocIO;
|
||||
using SampleBrowser.Core;
|
||||
using SampleBrowser.DocIO.UWP;
|
||||
using Xamarin.Forms.Platform.UWP;
|
||||
using Windows.ApplicationModel.Email;
|
||||
|
||||
[assembly: Dependency(typeof(SaveWindows))]
|
||||
[assembly: Dependency(typeof(MailService))]
|
||||
namespace SampleBrowser.DocIO.UWP
|
||||
{
|
||||
class SaveWindows: ISaveWindowsPhone
|
||||
{
|
||||
|
||||
public async Task Save(string filename, string contentType, MemoryStream stream)
|
||||
{
|
||||
if (Device.Idiom != TargetIdiom.Desktop)
|
||||
{
|
||||
StorageFolder local = Windows.Storage.ApplicationData.Current.LocalFolder;
|
||||
StorageFile outFile = await local.CreateFileAsync(filename, CreationCollisionOption.ReplaceExisting);
|
||||
using (Stream outStream = await outFile.OpenStreamForWriteAsync())
|
||||
{
|
||||
outStream.Write(stream.ToArray(), 0, (int)stream.Length);
|
||||
}
|
||||
if (contentType != "application/html")
|
||||
await Windows.System.Launcher.LaunchFileAsync(outFile);
|
||||
}
|
||||
else
|
||||
{
|
||||
StorageFile storageFile = null;
|
||||
FileSavePicker savePicker = new FileSavePicker();
|
||||
savePicker.SuggestedStartLocation = PickerLocationId.Desktop;
|
||||
savePicker.SuggestedFileName = filename;
|
||||
switch (contentType)
|
||||
{
|
||||
case "application/vnd.openxmlformats-officedocument.presentationml.presentation":
|
||||
savePicker.FileTypeChoices.Add("PowerPoint Presentation", new List<string>() { ".pptx", });
|
||||
break;
|
||||
case "application/msexcel":
|
||||
savePicker.FileTypeChoices.Add("Excel Files", new List<string>() { ".xlsx", });
|
||||
break;
|
||||
case "application/msword":
|
||||
savePicker.FileTypeChoices.Add("Word Document", new List<string>() { ".docx" });
|
||||
break;
|
||||
case "application/pdf":
|
||||
savePicker.FileTypeChoices.Add("Adobe PDF Document", new List<string>() { ".pdf" });
|
||||
break;
|
||||
case "application/html":
|
||||
savePicker.FileTypeChoices.Add("HTML Files", new List<string>() { ".html" });
|
||||
break;
|
||||
}
|
||||
storageFile = await savePicker.PickSaveFileAsync();
|
||||
|
||||
if (storageFile != null)
|
||||
{
|
||||
using (Stream outStream = await storageFile.OpenStreamForWriteAsync())
|
||||
{
|
||||
if (outStream.CanSeek)
|
||||
outStream.SetLength(0);
|
||||
outStream.Write(stream.ToArray(), 0, (int)stream.Length);
|
||||
outStream.Flush();
|
||||
outStream.Dispose();
|
||||
}
|
||||
}
|
||||
stream.Flush();
|
||||
stream.Dispose();
|
||||
if (storageFile != null)
|
||||
await Windows.System.Launcher.LaunchFileAsync(storageFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal class SfImageRenderer : ImageRenderer
|
||||
{
|
||||
public SfImageRenderer()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
this.Element.PropertyChanged -= OnElementPropertyChanged;
|
||||
base.Dispose(false);
|
||||
}
|
||||
}
|
||||
public class MailService : IMailService
|
||||
{
|
||||
public async void ComposeMail(string fileName, string[] recipients, string subject, string messagebody, MemoryStream documentStream)
|
||||
{
|
||||
var emailMessage = new EmailMessage
|
||||
{
|
||||
Subject = subject,
|
||||
Body = messagebody
|
||||
};
|
||||
StorageFolder local = Windows.Storage.ApplicationData.Current.LocalFolder;
|
||||
|
||||
StorageFile outFile = await local.CreateFileAsync(fileName, CreationCollisionOption.ReplaceExisting);
|
||||
|
||||
using (Stream outStream = await outFile.OpenStreamForWriteAsync())
|
||||
{
|
||||
outStream.Write(documentStream.ToArray(), 0, (int)documentStream.Length);
|
||||
}
|
||||
emailMessage.Attachments.Add(new EmailAttachment(fileName, outFile));
|
||||
|
||||
await EmailManager.ShowComposeNewEmailAsync(emailMessage);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
#region Copyright Syncfusion Inc. 2001-2019.
|
||||
// Copyright Syncfusion Inc. 2001-2019. 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 Foundation;
|
||||
using UIKit;
|
||||
|
||||
namespace SampleBrowser.DocIO.iOS
|
||||
{
|
||||
// The UIApplicationDelegate for the application. This class is responsible for launching the
|
||||
// User Interface of the application, as well as listening (and optionally responding) to
|
||||
// application events from iOS.
|
||||
[Register("AppDelegate")]
|
||||
public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate
|
||||
{
|
||||
//
|
||||
// This method is invoked when the application has loaded and is ready to run. In this
|
||||
// method you should instantiate the window, load the UI into it and then make the window
|
||||
// visible.
|
||||
//
|
||||
// You have 17 seconds to return from this method, or iOS will terminate your application.
|
||||
//
|
||||
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
|
||||
{
|
||||
global::Xamarin.Forms.Forms.Init();
|
||||
Syncfusion.ListView.XForms.iOS.SfListViewRenderer.Init();
|
||||
SampleBrowser.Core.iOS.CoreSampleBrowser.Init(UIScreen.MainScreen.Bounds, app.StatusBarFrame.Size.Height);
|
||||
LoadApplication(new App());
|
||||
|
||||
|
||||
return base.FinishedLaunching(app, options);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,226 @@
|
|||
{
|
||||
"images": [
|
||||
{
|
||||
"filename": "icon_29x29.png",
|
||||
"size": "29x29",
|
||||
"scale": "1x",
|
||||
"idiom": "iphone"
|
||||
},
|
||||
{
|
||||
"filename": "icon_58x58.png",
|
||||
"size": "29x29",
|
||||
"scale": "2x",
|
||||
"idiom": "iphone"
|
||||
},
|
||||
{
|
||||
"filename": "icon_87x87.png",
|
||||
"size": "29x29",
|
||||
"scale": "3x",
|
||||
"idiom": "iphone"
|
||||
},
|
||||
{
|
||||
"filename": "icon_80x80.png",
|
||||
"size": "40x40",
|
||||
"scale": "2x",
|
||||
"idiom": "iphone"
|
||||
},
|
||||
{
|
||||
"filename": "Icon-60@2x.png",
|
||||
"size": "40x40",
|
||||
"scale": "3x",
|
||||
"idiom": "iphone"
|
||||
},
|
||||
{
|
||||
"size": "57x57",
|
||||
"scale": "1x",
|
||||
"idiom": "iphone"
|
||||
},
|
||||
{
|
||||
"size": "57x57",
|
||||
"scale": "2x",
|
||||
"idiom": "iphone"
|
||||
},
|
||||
{
|
||||
"filename": "Icon-60@2x.png",
|
||||
"size": "60x60",
|
||||
"scale": "2x",
|
||||
"idiom": "iphone"
|
||||
},
|
||||
{
|
||||
"filename": "Icon-60@3x.png",
|
||||
"size": "60x60",
|
||||
"scale": "3x",
|
||||
"idiom": "iphone"
|
||||
},
|
||||
{
|
||||
"filename": "icon_29x29.png",
|
||||
"size": "29x29",
|
||||
"scale": "1x",
|
||||
"idiom": "ipad"
|
||||
},
|
||||
{
|
||||
"filename": "icon_58x58.png",
|
||||
"size": "29x29",
|
||||
"scale": "2x",
|
||||
"idiom": "ipad"
|
||||
},
|
||||
{
|
||||
"size": "40x40",
|
||||
"scale": "1x",
|
||||
"idiom": "ipad"
|
||||
},
|
||||
{
|
||||
"size": "40x40",
|
||||
"scale": "2x",
|
||||
"idiom": "ipad"
|
||||
},
|
||||
{
|
||||
"size": "50x50",
|
||||
"scale": "1x",
|
||||
"idiom": "ipad"
|
||||
},
|
||||
{
|
||||
"size": "50x50",
|
||||
"scale": "2x",
|
||||
"idiom": "ipad"
|
||||
},
|
||||
{
|
||||
"size": "83.5x83.5",
|
||||
"scale": "2x",
|
||||
"idiom": "ipad"
|
||||
},
|
||||
{
|
||||
"size": "72x72",
|
||||
"scale": "1x",
|
||||
"idiom": "ipad"
|
||||
},
|
||||
{
|
||||
"size": "72x72",
|
||||
"scale": "2x",
|
||||
"idiom": "ipad"
|
||||
},
|
||||
{
|
||||
"filename": "icon_76x76.png",
|
||||
"size": "76x76",
|
||||
"scale": "1x",
|
||||
"idiom": "ipad"
|
||||
},
|
||||
{
|
||||
"filename": "icon_152x152.png",
|
||||
"size": "76x76",
|
||||
"scale": "2x",
|
||||
"idiom": "ipad"
|
||||
},
|
||||
{
|
||||
"role": "notificationCenter",
|
||||
"size": "24x24",
|
||||
"subtype": "38mm",
|
||||
"scale": "2x",
|
||||
"idiom": "watch"
|
||||
},
|
||||
{
|
||||
"role": "notificationCenter",
|
||||
"size": "27.5x27.5",
|
||||
"subtype": "42mm",
|
||||
"scale": "2x",
|
||||
"idiom": "watch"
|
||||
},
|
||||
{
|
||||
"role": "companionSettings",
|
||||
"filename": "icon_58x58.png",
|
||||
"size": "29x29",
|
||||
"scale": "2x",
|
||||
"idiom": "watch"
|
||||
},
|
||||
{
|
||||
"role": "companionSettings",
|
||||
"filename": "icon_87x87.png",
|
||||
"size": "29x29",
|
||||
"scale": "3x",
|
||||
"idiom": "watch"
|
||||
},
|
||||
{
|
||||
"role": "appLauncher",
|
||||
"filename": "icon_80x80.png",
|
||||
"size": "40x40",
|
||||
"subtype": "38mm",
|
||||
"scale": "2x",
|
||||
"idiom": "watch"
|
||||
},
|
||||
{
|
||||
"role": "longLook",
|
||||
"size": "44x44",
|
||||
"subtype": "42mm",
|
||||
"scale": "2x",
|
||||
"idiom": "watch"
|
||||
},
|
||||
{
|
||||
"role": "quickLook",
|
||||
"size": "86x86",
|
||||
"subtype": "38mm",
|
||||
"scale": "2x",
|
||||
"idiom": "watch"
|
||||
},
|
||||
{
|
||||
"role": "quickLook",
|
||||
"size": "98x98",
|
||||
"subtype": "42mm",
|
||||
"scale": "2x",
|
||||
"idiom": "watch"
|
||||
},
|
||||
{
|
||||
"size": "16x16",
|
||||
"scale": "1x",
|
||||
"idiom": "mac"
|
||||
},
|
||||
{
|
||||
"size": "16x16",
|
||||
"scale": "2x",
|
||||
"idiom": "mac"
|
||||
},
|
||||
{
|
||||
"size": "32x32",
|
||||
"scale": "1x",
|
||||
"idiom": "mac"
|
||||
},
|
||||
{
|
||||
"size": "32x32",
|
||||
"scale": "2x",
|
||||
"idiom": "mac"
|
||||
},
|
||||
{
|
||||
"size": "128x128",
|
||||
"scale": "1x",
|
||||
"idiom": "mac"
|
||||
},
|
||||
{
|
||||
"size": "128x128",
|
||||
"scale": "2x",
|
||||
"idiom": "mac"
|
||||
},
|
||||
{
|
||||
"size": "256x256",
|
||||
"scale": "1x",
|
||||
"idiom": "mac"
|
||||
},
|
||||
{
|
||||
"size": "256x256",
|
||||
"scale": "2x",
|
||||
"idiom": "mac"
|
||||
},
|
||||
{
|
||||
"size": "512x512",
|
||||
"scale": "1x",
|
||||
"idiom": "mac"
|
||||
},
|
||||
{
|
||||
"size": "512x512",
|
||||
"scale": "2x",
|
||||
"idiom": "mac"
|
||||
}
|
||||
],
|
||||
"info": {
|
||||
"version": 1,
|
||||
"author": "xcode"
|
||||
}
|
||||
}
|
После Ширина: | Высота: | Размер: 5.6 KiB |
После Ширина: | Высота: | Размер: 8.8 KiB |
После Ширина: | Высота: | Размер: 7.2 KiB |
После Ширина: | Высота: | Размер: 1.9 KiB |
После Ширина: | Высота: | Размер: 3.0 KiB |
После Ширина: | Высота: | Размер: 3.8 KiB |
После Ширина: | Высота: | Размер: 6.0 KiB |
После Ширина: | Высота: | Размер: 7.0 KiB |
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>UIDeviceFamily</key>
|
||||
<array>
|
||||
<integer>1</integer>
|
||||
<integer>2</integer>
|
||||
</array>
|
||||
<key>UILaunchStoryboardName</key>
|
||||
<string>LaunchScreen</string>
|
||||
<key>UIRequiredDeviceCapabilities</key>
|
||||
<array>
|
||||
<string>armv7</string>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations~ipad</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationPortraitUpsideDown</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>MinimumOSVersion</key>
|
||||
<string>10.2</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.syncfusion.samplebrowser.docio</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.0</string>
|
||||
<key>XSAppIconAssets</key>
|
||||
<string>Assets.xcassets/AppIcon.appiconset</string>
|
||||
<key>UIMainStoryboardFile</key>
|
||||
<string>LaunchScreen</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>DocIO Sample</string>
|
||||
<key>UIRequiresFullScreen</key>
|
||||
<true/>
|
||||
<key>UIStatusBarHidden</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
|
@ -0,0 +1,48 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13196" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13173"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--View Controller-->
|
||||
<scene sceneID="EHf-IW-A2E">
|
||||
<objects>
|
||||
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
|
||||
<layoutGuides>
|
||||
<viewControllerLayoutGuide type="top" id="25"/>
|
||||
<viewControllerLayoutGuide type="bottom" id="26"/>
|
||||
</layoutGuides>
|
||||
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3" userLabel="UIImageView">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" misplaced="YES" image="Launch.png" translatesAutoresizingMaskIntoConstraints="NO" id="9">
|
||||
<rect key="frame" x="0.0" y="0.0" width="1024" height="1366"/>
|
||||
<accessibility key="accessibilityConfiguration">
|
||||
<accessibilityTraits key="traits" image="YES" adjustable="YES"/>
|
||||
</accessibility>
|
||||
</imageView>
|
||||
</subviews>
|
||||
<color key="backgroundColor" red="0.043137254901960784" green="0.396078431372549" blue="0.87450980392156863" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<constraints>
|
||||
<constraint firstItem="9" firstAttribute="leading" secondItem="Ze5-6b-2t3" secondAttribute="leading" id="5Pp-ad-0e9"/>
|
||||
<constraint firstItem="9" firstAttribute="top" secondItem="Ze5-6b-2t3" secondAttribute="top" id="Qh3-BI-SYx"/>
|
||||
<constraint firstItem="9" firstAttribute="top" secondItem="Ze5-6b-2t3" secondAttribute="top" id="Vw3-WQ-V0s"/>
|
||||
<constraint firstItem="9" firstAttribute="centerX" secondItem="Ze5-6b-2t3" secondAttribute="centerX" id="bOh-ga-Mqn"/>
|
||||
<constraint firstItem="9" firstAttribute="leading" secondItem="Ze5-6b-2t3" secondAttribute="leading" id="rKd-8B-Xi9"/>
|
||||
<constraint firstItem="9" firstAttribute="bottom" secondItem="26" secondAttribute="top" id="rdg-Zc-hcq"/>
|
||||
<constraint firstItem="26" firstAttribute="top" secondItem="9" secondAttribute="bottom" id="vdm-Ck-t1F"/>
|
||||
<constraint firstAttribute="trailing" secondItem="9" secondAttribute="trailing" id="vmn-ia-DmA"/>
|
||||
</constraints>
|
||||
</view>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="52" y="374.6627"/>
|
||||
</scene>
|
||||
</scenes>
|
||||
<resources>
|
||||
<image name="icon_512x512.png" width="512" height="512"/>
|
||||
</resources>
|
||||
</document>
|
|
@ -0,0 +1,22 @@
|
|||
#region Copyright Syncfusion Inc. 2001-2019.
|
||||
// Copyright Syncfusion Inc. 2001-2019. 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 UIKit;
|
||||
|
||||
namespace SampleBrowser.DocIO.iOS
|
||||
{
|
||||
public class Application
|
||||
{
|
||||
// This is the main entry point of the application.
|
||||
static void Main(string[] args)
|
||||
{
|
||||
// if you want to use a different Application Delegate class from "AppDelegate"
|
||||
// you can specify it here.
|
||||
UIApplication.Main(args, null, "AppDelegate");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
#region Copyright Syncfusion Inc. 2001 - 2019
|
||||
// Copyright Syncfusion Inc. 2001 - 2019. 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 QuickLook;
|
||||
|
||||
namespace SampleBrowser.DocIO.iOS
|
||||
{
|
||||
public class PreviewControllerDS : QLPreviewControllerDataSource
|
||||
{
|
||||
private QLPreviewItem _item;
|
||||
|
||||
public PreviewControllerDS(QLPreviewItem item)
|
||||
{
|
||||
_item = item;
|
||||
}
|
||||
|
||||
public override nint PreviewItemCount (QLPreviewController controller)
|
||||
{
|
||||
return (nint)1;
|
||||
}
|
||||
|
||||
public override IQLPreviewItem GetPreviewItem (QLPreviewController controller, nint index)
|
||||
{
|
||||
return _item;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
#region Copyright Syncfusion Inc. 2001-2019.
|
||||
// Copyright Syncfusion Inc. 2001-2019. 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.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using Xamarin.Forms.Internals;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("SampleBrowser.DocIO.iOS")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Syncfusion Inc.")]
|
||||
[assembly: AssemblyProduct("SampleBrowser.DocIO.iOS")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2001-2019 Syncfusion Inc.")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
[assembly:Preserve]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("72bdc44f-c588-44f3-b6df-9aace7daafdd")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
|
@ -0,0 +1,68 @@
|
|||
#region Copyright Syncfusion Inc. 2001 - 2019
|
||||
// Copyright Syncfusion Inc. 2001 - 2019. 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 QuickLook;
|
||||
using Foundation;
|
||||
using System.IO;
|
||||
|
||||
namespace SampleBrowser.DocIO.iOS
|
||||
{
|
||||
public class QLPreviewItemFileSystem : QLPreviewItem
|
||||
{
|
||||
string _fileName, _filePath;
|
||||
|
||||
public QLPreviewItemFileSystem(string fileName, string filePath)
|
||||
{
|
||||
_fileName = fileName;
|
||||
_filePath = filePath;
|
||||
}
|
||||
|
||||
public override string ItemTitle
|
||||
{
|
||||
get
|
||||
{
|
||||
return _fileName;
|
||||
}
|
||||
}
|
||||
public override NSUrl ItemUrl
|
||||
{
|
||||
get
|
||||
{
|
||||
return NSUrl.FromFilename(_filePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class QLPreviewItemBundle : QLPreviewItem
|
||||
{
|
||||
string _fileName, _filePath;
|
||||
public QLPreviewItemBundle(string fileName, string filePath)
|
||||
{
|
||||
_fileName = fileName;
|
||||
_filePath = filePath;
|
||||
}
|
||||
|
||||
public override string ItemTitle
|
||||
{
|
||||
get
|
||||
{
|
||||
return _fileName;
|
||||
}
|
||||
}
|
||||
public override NSUrl ItemUrl
|
||||
{
|
||||
get
|
||||
{
|
||||
var documents = NSBundle.MainBundle.BundlePath;
|
||||
var lib = Path.Combine(documents, _filePath);
|
||||
var url = NSUrl.FromFilename(lib);
|
||||
return url;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
После Ширина: | Высота: | Размер: 2.8 KiB |
После Ширина: | Высота: | Размер: 5.1 KiB |
После Ширина: | Высота: | Размер: 8.2 KiB |
После Ширина: | Высота: | Размер: 1.0 MiB |
|
@ -0,0 +1,176 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">iPhoneSimulator</Platform>
|
||||
<ProductVersion>8.0.30703</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{F4D99EF7-F197-428F-92DE-7482DBAD7476}</ProjectGuid>
|
||||
<ProjectTypeGuids>{FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RootNamespace>SampleBrowser.DocIO.iOS</RootNamespace>
|
||||
<IPhoneResourcePrefix>Resources</IPhoneResourcePrefix>
|
||||
<AssemblyName>SampleBrowser.DocIO.iOS</AssemblyName>
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhoneSimulator' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\iPhoneSimulator\Debug</OutputPath>
|
||||
<DefineConstants>DEBUG</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
<MtouchArch>x86_64</MtouchArch>
|
||||
<MtouchLink>None</MtouchLink>
|
||||
<MtouchDebug>true</MtouchDebug>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' ">
|
||||
<DebugType>none</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\iPhoneSimulator\Release</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<MtouchLink>None</MtouchLink>
|
||||
<MtouchArch>x86_64</MtouchArch>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhone' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\iPhone\Debug</OutputPath>
|
||||
<DefineConstants>DEBUG</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
<MtouchArch>ARM64</MtouchArch>
|
||||
<CodesignKey>iPhone Developer</CodesignKey>
|
||||
<MtouchDebug>true</MtouchDebug>
|
||||
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' ">
|
||||
<DebugType>none</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\iPhone\Release</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<MtouchArch>ARM64</MtouchArch>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
<CodesignKey>iPhone Developer</CodesignKey>
|
||||
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Ad-Hoc|iPhone' ">
|
||||
<DebugType>none</DebugType>
|
||||
<Optimize>True</Optimize>
|
||||
<OutputPath>bin\iPhone\Ad-Hoc</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>False</ConsolePause>
|
||||
<MtouchArch>ARM64</MtouchArch>
|
||||
<BuildIpa>True</BuildIpa>
|
||||
<CodesignProvision>Automatic:AdHoc</CodesignProvision>
|
||||
<CodesignKey>iPhone Distribution</CodesignKey>
|
||||
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'AppStore|iPhone' ">
|
||||
<DebugType>none</DebugType>
|
||||
<Optimize>True</Optimize>
|
||||
<OutputPath>bin\iPhone\AppStore</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>False</ConsolePause>
|
||||
<MtouchArch>ARM64</MtouchArch>
|
||||
<CodesignProvision>Automatic:AppStore</CodesignProvision>
|
||||
<CodesignKey>iPhone Distribution</CodesignKey>
|
||||
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Main.cs" />
|
||||
<Compile Include="AppDelegate.cs" />
|
||||
<Compile Include="QLPreviewItemFileSystem.cs" />
|
||||
<Compile Include="SaveIOS.cs" />
|
||||
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Contents.json" >
|
||||
<Visible>false</Visible>
|
||||
</ImageAsset>
|
||||
<None Include="Entitlements.plist" />
|
||||
<None Include="Info.plist" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="PreviewControllerDS.cs" />
|
||||
<InterfaceDefinition Include="LaunchScreen.storyboard" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BundleResource Include="Resources\DocIO.png" />
|
||||
<BundleResource Include="Resources\DocIO%402x.png" />
|
||||
<BundleResource Include="Resources\DocIO%403x.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ITunesArtwork Include="iTunesArtwork" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BundleResource Include="Resources\icon_512x512.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon-60%402x.png">
|
||||
<Visible>false</Visible>
|
||||
</ImageAsset>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\icon_87x87.png">
|
||||
<Visible>false</Visible>
|
||||
</ImageAsset>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\icon_80x80.png">
|
||||
<Visible>false</Visible>
|
||||
</ImageAsset>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\icon_76x76.png">
|
||||
<Visible>false</Visible>
|
||||
</ImageAsset>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\icon_29x29.png">
|
||||
<Visible>false</Visible>
|
||||
</ImageAsset>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\icon_58x58.png">
|
||||
<Visible>false</Visible>
|
||||
</ImageAsset>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\icon_152x152.png">
|
||||
<Visible>false</Visible>
|
||||
</ImageAsset>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon-60%403x.png">
|
||||
<Visible>false</Visible>
|
||||
</ImageAsset>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="Xamarin.iOS" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="SampleBrowser.Core" Version="17.1.0.38" />
|
||||
<PackageReference Include="Syncfusion.Xamarin.Core" Version="17.1.0.38" />
|
||||
<PackageReference Include="Syncfusion.Xamarin.DataSource" Version="17.1.0.38" />
|
||||
<PackageReference Include="Syncfusion.Xamarin.GridCommon" Version="17.1.0.38" />
|
||||
<PackageReference Include="Syncfusion.Xamarin.SfListView" Version="17.1.0.38" />
|
||||
<PackageReference Include="Xamarin.Forms" Version="3.2.0.871581" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\DocIO\SampleBrowser.DocIO.csproj">
|
||||
<Project>{EB5CBDB6-C051-446B-BDDF-A00B0F1829D1}</Project>
|
||||
<Name>SampleBrowser.DocIO</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -0,0 +1,28 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Compile Include="$(MSBuildThisFileDirectory)\QLPreviewItemFileSystem.cs">
|
||||
<Link>DocIO\QLPreviewItemFileSystem.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="$(MSBuildThisFileDirectory)\SaveIOS.cs">
|
||||
<Link>DocIO\SaveIOS.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="$(MSBuildThisFileDirectory)\PreviewControllerDS.cs">
|
||||
<Link>DocIO\PreviewControllerDS.cs</Link>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BundleResource Include="$(MSBuildThisFileDirectory)\Resources\DocIO.png" >
|
||||
<Link>Resources\DocIO.png</Link>
|
||||
</BundleResource>
|
||||
<BundleResource Include="$(MSBuildThisFileDirectory)\Resources\DocIO%402x.png" >
|
||||
<Link>Resources\DocIO%402x.png</Link>
|
||||
</BundleResource>
|
||||
<BundleResource Include="$(MSBuildThisFileDirectory)\Resources\DocIO%403x.png" >
|
||||
<Link>Resources\DocIO%403x.png</Link>
|
||||
</BundleResource>
|
||||
<BundleResource Include="$(MSBuildThisFileDirectory)\Resources\icon_512x512.png" >
|
||||
<Link>Resources\icon_512x512.png</Link>
|
||||
</BundleResource>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -0,0 +1,143 @@
|
|||
#region Copyright Syncfusion Inc. 2001 - 2019
|
||||
// Copyright Syncfusion Inc. 2001 - 2019. 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.IO;
|
||||
|
||||
using Foundation;
|
||||
using UIKit;
|
||||
using QuickLook;
|
||||
|
||||
using Xamarin.Forms;
|
||||
using SampleBrowser.DocIO.iOS;
|
||||
using MessageUI;
|
||||
|
||||
[assembly: Dependency(typeof(SaveIOS))]
|
||||
[assembly: Dependency(typeof(MailService))]
|
||||
namespace SampleBrowser.DocIO.iOS
|
||||
{
|
||||
class SaveIOS: ISave
|
||||
{
|
||||
public void Save(string filename, string contentType, MemoryStream stream)
|
||||
{
|
||||
string exception = string.Empty;
|
||||
string path = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
|
||||
string filePath = Path.Combine(path, filename);
|
||||
try
|
||||
{
|
||||
FileStream fileStream = File.Open(filePath, FileMode.Create);
|
||||
stream.Position = 0;
|
||||
stream.CopyTo(fileStream);
|
||||
fileStream.Flush();
|
||||
fileStream.Close();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
exception = e.ToString();
|
||||
}
|
||||
if (contentType == "application/html" || exception != string.Empty)
|
||||
return;
|
||||
UIViewController currentController = UIApplication.SharedApplication.KeyWindow.RootViewController;
|
||||
while (currentController.PresentedViewController != null)
|
||||
currentController = currentController.PresentedViewController;
|
||||
UIView currentView = currentController.View;
|
||||
|
||||
QLPreviewController qlPreview = new QLPreviewController();
|
||||
QLPreviewItem item = new QLPreviewItemBundle(filename, filePath);
|
||||
qlPreview.DataSource = new PreviewControllerDS(item);
|
||||
|
||||
//UIViewController uiView = currentView as UIViewController;
|
||||
|
||||
currentController.PresentViewController((UIViewController)qlPreview, true, (Action)null);
|
||||
}
|
||||
}
|
||||
public class MailService : IMailService
|
||||
{
|
||||
public MailService()
|
||||
{
|
||||
}
|
||||
|
||||
public void ComposeMail(string fileName, string[] recipients, string subject, string messagebody, MemoryStream stream)
|
||||
{
|
||||
if (MFMailComposeViewController.CanSendMail)
|
||||
{
|
||||
|
||||
var mailer = new MFMailComposeViewController();
|
||||
|
||||
mailer.SetMessageBody(messagebody ?? string.Empty, false);
|
||||
mailer.SetSubject(subject ?? subject);
|
||||
mailer.Finished += (s, e) => ((MFMailComposeViewController)s).DismissViewController(true, () => { });
|
||||
|
||||
|
||||
string exception = string.Empty;
|
||||
string path = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
|
||||
string filePath = Path.Combine(path, fileName);
|
||||
try
|
||||
{
|
||||
FileStream fileStream = File.Open(filePath, FileMode.Create);
|
||||
stream.Position = 0;
|
||||
stream.CopyTo(fileStream);
|
||||
fileStream.Flush();
|
||||
fileStream.Close();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
exception = e.ToString();
|
||||
}
|
||||
finally
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
mailer.AddAttachmentData(NSData.FromFile(filePath), GetMimeType(fileName), Path.GetFileName(fileName));
|
||||
|
||||
|
||||
|
||||
UIViewController vc = UIApplication.SharedApplication.KeyWindow.RootViewController;
|
||||
while (vc.PresentedViewController != null)
|
||||
{
|
||||
vc = vc.PresentedViewController;
|
||||
}
|
||||
vc.PresentViewController(mailer, true, null);
|
||||
}
|
||||
}
|
||||
|
||||
private string GetMimeType(string filename)
|
||||
{
|
||||
if (string.IsNullOrEmpty(filename))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var extension = Path.GetExtension(filename.ToLowerInvariant());
|
||||
|
||||
switch (extension)
|
||||
{
|
||||
case "png":
|
||||
return "image/png";
|
||||
case "doc":
|
||||
return "application/msword";
|
||||
case "pdf":
|
||||
return "application/pdf";
|
||||
case "jpeg":
|
||||
case "jpg":
|
||||
return "image/jpeg";
|
||||
case "zip":
|
||||
case "docx":
|
||||
case "xlsx":
|
||||
case "pptx":
|
||||
return "application/zip";
|
||||
case "htm":
|
||||
case "html":
|
||||
return "text/html";
|
||||
}
|
||||
|
||||
return "application/octet-stream";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
После Ширина: | Высота: | Размер: 1.0 MiB |
После Ширина: | Высота: | Размер: 20 KiB |
|
@ -0,0 +1,38 @@
|
|||
#region Copyright Syncfusion Inc. 2001-2019.
|
||||
// Copyright Syncfusion Inc. 2001-2019. 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 Xamarin.Forms;
|
||||
using Xamarin.Forms.Internals;
|
||||
|
||||
namespace SampleBrowser.DocIO
|
||||
{
|
||||
[Preserve(AllMembers = true)]
|
||||
public class App : Application
|
||||
{
|
||||
public static bool isUWP;
|
||||
public App()
|
||||
{
|
||||
var page = SampleBrowser.Core.SampleBrowser.GetMainPage("DocIO", "SampleBrowser.DocIO");
|
||||
MainPage = page;
|
||||
}
|
||||
|
||||
protected override void OnStart()
|
||||
{
|
||||
// Handle when your app starts
|
||||
}
|
||||
|
||||
protected override void OnSleep()
|
||||
{
|
||||
// Handle when your app sleeps
|
||||
}
|
||||
|
||||
protected override void OnResume()
|
||||
{
|
||||
// Handle when your app resumes
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
#region Copyright Syncfusion Inc. 2001-2019.
|
||||
// Copyright Syncfusion Inc. 2001-2019. 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.IO;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SampleBrowser.DocIO
|
||||
{
|
||||
public interface ISave
|
||||
{
|
||||
void Save(string filename, string contentType, MemoryStream stream);
|
||||
}
|
||||
public interface ISaveWindowsPhone
|
||||
{
|
||||
Task Save(string filename, string contentType, MemoryStream stream);
|
||||
}
|
||||
|
||||
public interface IAndroidVersionDependencyService
|
||||
{
|
||||
int GetAndroidVersion();
|
||||
}
|
||||
public interface IMailService
|
||||
{
|
||||
void ComposeMail(string fileName, string[] recipients, string subject, string messagebody, MemoryStream documentStream);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
#region Copyright Syncfusion Inc. 2001-2019.
|
||||
// Copyright Syncfusion Inc. 2001-2019. 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.Resources;
|
||||
using System.Reflection;
|
||||
using Xamarin.Forms.Xaml;
|
||||
using Xamarin.Forms.Internals;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("SampleBrowser.DocIO")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Syncfusion Inc.")]
|
||||
[assembly: AssemblyProduct("SampleBrowser.DocIO")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2001-2019 Syncfusion Inc.")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
[assembly: NeutralResourcesLanguage("en")]
|
||||
[assembly: XamlCompilation(XamlCompilationOptions.Compile)]
|
||||
[assembly:Preserve]
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
|
@ -0,0 +1,47 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard1.4</TargetFramework>
|
||||
<PackageId>SampleBrowser.DocIO</PackageId>
|
||||
<Configurations>Debug;Release;Release-xml</Configurations>
|
||||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
||||
<GenerateAssemblyVersionAttribute>false</GenerateAssemblyVersionAttribute>
|
||||
<RootNamespace>SampleBrowser.DocIO</RootNamespace>
|
||||
<AssemblyName>SampleBrowser.DocIO</AssemblyName>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<None Remove="SampleBrowser.DocIO.nuspec" />
|
||||
<None Remove="SampleBrowser.DocIO.props" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="SampleBrowser.Core" Version="17.1.0.38" />
|
||||
<PackageReference Include="Syncfusion.Xamarin.Compression" Version="17.1.0.38" />
|
||||
<PackageReference Include="Syncfusion.Xamarin.Core" Version="17.1.0.38" />
|
||||
<PackageReference Include="Syncfusion.Xamarin.OfficeChart" Version="17.1.0.38" />
|
||||
<PackageReference Include="Syncfusion.Xamarin.DataSource" Version="17.1.0.38" />
|
||||
<PackageReference Include="Syncfusion.Xamarin.DocIO" Version="17.1.0.38" />
|
||||
<PackageReference Include="Syncfusion.Xamarin.GridCommon" Version="17.1.0.38" />
|
||||
<PackageReference Include="Syncfusion.Xamarin.SfListView" Version="17.1.0.38" />
|
||||
<PackageReference Include="Xamarin.Forms" Version="3.2.0.871581" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Samples\Templates\BkmkDocumentPart_Template.doc" />
|
||||
<EmbeddedResource Include="Samples\Templates\Bookmark_Template.doc" />
|
||||
<EmbeddedResource Include="Samples\Templates\ContentControlTemplate.docx" />
|
||||
<EmbeddedResource Include="Samples\Templates\WordtoHTML.doc" />
|
||||
<EmbeddedResource Include="Samples\Templates\Excel_Template.xlsx" />
|
||||
<EmbeddedResource Include="Samples\Templates\Letter Formatting.docx" />
|
||||
<EmbeddedResource Include="Samples\Templates\Employees.xml" />
|
||||
<EmbeddedResource Include="Samples\Templates\Mountain-200.jpg" />
|
||||
<EmbeddedResource Include="Samples\Templates\Mountain-300.jpg" />
|
||||
<EmbeddedResource Include="Samples\Templates\Northwind.png" />
|
||||
<EmbeddedResource Include="Samples\Templates\Products.xml" />
|
||||
<EmbeddedResource Include="Samples\Templates\Road-550-W.jpg" />
|
||||
<EmbeddedResource Include="Samples\Templates\AdventureCycle.jpg" />
|
||||
<EmbeddedResource Include="SamplesList\SamplesList.xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Condition=" '$(EnableDefaultCompileItems)' == 'true' " Update="App.cs">
|
||||
<DependentUpon>*.xaml</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -0,0 +1,143 @@
|
|||
<Project>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="$(MSBuildThisFileDirectory)\SamplesList\SamplesList.xml">
|
||||
<Link>Samples\DocIO\SamplesList\SamplesList.xml</Link>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="$(MSBuildThisFileDirectory)\Samples\Templates\BkmkDocumentPart_Template.doc">
|
||||
<Link>Samples\DocIO\Samples\Templates\BkmkDocumentPart_Template.doc</Link>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="$(MSBuildThisFileDirectory)\Samples\Templates\Bookmark_Template.doc">
|
||||
<Link>Samples\DocIO\Samples\Templates\Bookmark_Template.doc</Link>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="$(MSBuildThisFileDirectory)\Samples\Templates\ContentControlTemplate.docx">
|
||||
<Link>Samples\DocIO\Samples\Templates\ContentControlTemplate.docx</Link>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="$(MSBuildThisFileDirectory)\Samples\Templates\Excel_Template.xlsx">
|
||||
<Link>Samples\DocIO\Samples\Templates\Excel_Template.xlsx</Link>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="$(MSBuildThisFileDirectory)\Samples\Templates\Letter Formatting.docx">
|
||||
<Link>Samples\DocIO\Samples\Templates\Letter Formatting.docx</Link>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="$(MSBuildThisFileDirectory)\Samples\Templates\Employees.xml">
|
||||
<Link>Samples\DocIO\Samples\Templates\Employees.xml</Link>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="$(MSBuildThisFileDirectory)\Samples\Templates\Mountain-200.jpg">
|
||||
<Link>Samples\DocIO\Samples\Templates\Mountain-200.jpg</Link>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="$(MSBuildThisFileDirectory)\Samples\Templates\Mountain-300.jpg">
|
||||
<Link>Samples\DocIO\Samples\Templates\Mountain-300.jpg</Link>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="$(MSBuildThisFileDirectory)\Samples\Templates\Northwind.png">
|
||||
<Link>Samples\DocIO\Samples\Templates\Northwind.png</Link>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="$(MSBuildThisFileDirectory)\Samples\Templates\Products.xml">
|
||||
<Link>Samples\DocIO\Samples\Templates\Products.xml</Link>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="$(MSBuildThisFileDirectory)\Samples\Templates\Road-550-W.jpg">
|
||||
<Link>Samples\DocIO\Samples\Templates\Road-550-W.jpg</Link>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="$(MSBuildThisFileDirectory)\Samples\Templates\AdventureCycle.jpg">
|
||||
<Link>Samples\DocIO\Samples\Templates\AdventureCycle.jpg</Link>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="$(MSBuildThisFileDirectory)\Samples\Templates\WordtoHTML.doc">
|
||||
<Link>Samples\DocIO\Samples\Templates\WordtoHTML.doc</Link>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="$(MSBuildThisFileDirectory)\Samples\BookmarkNavigation\BookmarkNavigation.xaml">
|
||||
<Link>Samples\DocIO\Samples\BookmarkNavigation\BookmarkNavigation.xaml</Link>
|
||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="$(MSBuildThisFileDirectory)\Samples\BuiltInStyle\BuiltInStyle.xaml">
|
||||
<Link>Samples\DocIO\Samples\BuiltInStyle\BuiltInStyle.xaml</Link>
|
||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="$(MSBuildThisFileDirectory)\Samples\CustomStyle\CustomStyle.xaml">
|
||||
<Link>Samples\DocIO\Samples\CustomStyle\CustomStyle.xaml</Link>
|
||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="$(MSBuildThisFileDirectory)\Samples\DocIO_BarChart\DocIO_BarChart.xaml">
|
||||
<Link>Samples\DocIO\Samples\DocIO_BarChart\DocIO_BarChart.xaml</Link>
|
||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="$(MSBuildThisFileDirectory)\Samples\DocIO_PieChart\DocIO_PieChart.xaml">
|
||||
<Link>Samples\DocIO\Samples\DocIO_PieChart\DocIO_PieChart.xaml</Link>
|
||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="$(MSBuildThisFileDirectory)\Samples\FormFillingAndProtection\FormFillingAndProtection.xaml">
|
||||
<Link>Samples\DocIO\Samples\FormFillingAndProtection\FormFillingAndProtection.xaml</Link>
|
||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="$(MSBuildThisFileDirectory)\Samples\GettingStartedDocIO\GettingStarted.xaml">
|
||||
<Link>Samples\DocIO\Samples\GettingStartedDocIO\GettingStarted.xaml</Link>
|
||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="$(MSBuildThisFileDirectory)\Samples\MailMerge\MailMerge.xaml">
|
||||
<Link>Samples\DocIO\Samples\MailMerge\MailMerge.xaml</Link>
|
||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="$(MSBuildThisFileDirectory)\Samples\WordToHTML\WordToHTML.xaml">
|
||||
<Link>Samples\DocIO\Samples\WordToHTML\WordToHTML.xaml</Link>
|
||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="$(MSBuildThisFileDirectory)\Samples\XMLMapping\XMLMapping.xaml">
|
||||
<Link>Samples\DocIO\Samples\XMLMapping\XMLMapping.xaml</Link>
|
||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="$(MSBuildThisFileDirectory)\Samples\BookmarkNavigation\BookmarkNavigation.xaml.cs">
|
||||
<Link>Samples\DocIO\Samples\BookmarkNavigation\BookmarkNavigation.xaml.cs</Link>
|
||||
<DependentUpon>BookmarkNavigation.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="$(MSBuildThisFileDirectory)\Samples\BuiltInStyle\BuiltInStyle.xaml.cs">
|
||||
<Link>Samples\DocIO\Samples\BuiltInStyle\BuiltInStyle.xaml.cs</Link>
|
||||
<DependentUpon>BuiltInStyle.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="$(MSBuildThisFileDirectory)\Samples\CustomStyle\CustomStyle.xaml.cs">
|
||||
<Link>Samples\DocIO\Samples\CustomStyle\CustomStyle.xaml.cs</Link>
|
||||
<DependentUpon>CustomStyle.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="$(MSBuildThisFileDirectory)\Samples\DocIO_BarChart\DocIO_BarChart.xaml.cs">
|
||||
<Link>Samples\DocIO\Samples\DocIO_BarChart\DocIO_BarChart.xaml.cs</Link>
|
||||
<DependentUpon>DocIO_BarChart.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="$(MSBuildThisFileDirectory)\Samples\DocIO_PieChart\DocIO_PieChart.xaml.cs">
|
||||
<Link>Samples\DocIO\Samples\DocIO_PieChart\DocIO_PieChart.xaml.cs</Link>
|
||||
<DependentUpon>DocIO_PieChart.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="$(MSBuildThisFileDirectory)\Samples\FormFillingAndProtection\FormFillingAndProtection.xaml.cs">
|
||||
<Link>Samples\DocIO\Samples\FormFillingAndProtection\FormFillingAndProtection.xaml.cs</Link>
|
||||
<DependentUpon>FormFillingAndProtection.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="$(MSBuildThisFileDirectory)\Samples\GettingStartedDocIO\GettingStarted.xaml.cs">
|
||||
<Link>Samples\DocIO\Samples\GettingStartedDocIO\GettingStarted.xaml.cs</Link>
|
||||
<DependentUpon>GettingStarted.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="$(MSBuildThisFileDirectory)\Samples\MailMerge\MailMerge.xaml.cs">
|
||||
<Link>Samples\DocIO\Samples\MailMerge\MailMerge.xaml.cs</Link>
|
||||
<DependentUpon>MailMerge.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="$(MSBuildThisFileDirectory)\Samples\WordToHTML\WordToHTML.xaml.cs">
|
||||
<Link>Samples\DocIO\Samples\WordToHTML\WordToHTML.xaml.cs</Link>
|
||||
<DependentUpon>WordToHTML.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="$(MSBuildThisFileDirectory)\Samples\XMLMapping\XMLMapping.xaml.cs">
|
||||
<Link>Samples\DocIO\Samples\XMLMapping\XMLMapping.xaml.cs</Link>
|
||||
<DependentUpon>XMLMapping.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="$(MSBuildThisFileDirectory)\ISave.cs">
|
||||
<Link>Samples\DocIO\ISave.cs</Link>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -0,0 +1,29 @@
|
|||
#region Copyright Syncfusion Inc. 2001-2019.
|
||||
// Copyright Syncfusion Inc. 2001-2019. 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 SampleBrowser.Core;
|
||||
using Xamarin.Forms;
|
||||
using Xamarin.Forms.Internals;
|
||||
|
||||
namespace SampleBrowser.DocIO
|
||||
{
|
||||
[Preserve(AllMembers = true)]
|
||||
public class SamplePages : SampleView
|
||||
{
|
||||
public SamplePages()
|
||||
{
|
||||
Content = new StackLayout
|
||||
{
|
||||
Children = {
|
||||
new Label { Text = "Hello ContentPage" }
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<local:SampleView
|
||||
xmlns:local="clr-namespace:SampleBrowser.Core;assembly=SampleBrowser.Core"
|
||||
xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="SampleBrowser.DocIO.BookmarkNavigation">
|
||||
|
||||
<local:SampleView.Content>
|
||||
<StackLayout Padding ="10">
|
||||
|
||||
<Label x:Name="Content_1" Text="This sample illustrates how to insert, retrieve, replace and delete the contents of a specified bookmark using BookmarkNavigator functionality of DocIO."
|
||||
FontSize="Medium" VerticalOptions="Center">
|
||||
</Label>
|
||||
|
||||
<Label></Label>
|
||||
|
||||
<Button x:Name="btnGenerate" Clicked ="OnButtonClicked" Text ="Generate Word" HorizontalOptions="Center" VerticalOptions="Center"></Button>
|
||||
</StackLayout>
|
||||
</local:SampleView.Content>
|
||||
<local:SampleView.PropertyView>
|
||||
|
||||
</local:SampleView.PropertyView>
|
||||
|
||||
</local:SampleView>
|
|
@ -0,0 +1,223 @@
|
|||
#region Copyright Syncfusion Inc. 2001-2019.
|
||||
// Copyright Syncfusion Inc. 2001-2019. 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.DocIO;
|
||||
using SampleBrowser.Core;
|
||||
using Syncfusion.DocIO.DLS;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace SampleBrowser.DocIO
|
||||
{
|
||||
public partial class BookmarkNavigation : SampleView
|
||||
{
|
||||
public BookmarkNavigation()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
if (Device.Idiom != TargetIdiom.Phone && Device.RuntimePlatform == Device.UWP)
|
||||
{
|
||||
|
||||
this.Content_1.HorizontalOptions = LayoutOptions.Start;
|
||||
this.btnGenerate.HorizontalOptions = LayoutOptions.Start;
|
||||
|
||||
|
||||
this.Content_1.VerticalOptions = LayoutOptions.Center;
|
||||
this.btnGenerate.VerticalOptions = LayoutOptions.Center;
|
||||
this.btnGenerate.BackgroundColor = Color.Gray;
|
||||
}
|
||||
else if (Device.Idiom == TargetIdiom.Phone && Device.RuntimePlatform == Device.UWP)
|
||||
{
|
||||
//if (!SampleBrowser.DocIO.App.isUWP)
|
||||
//{
|
||||
// this.Content_1.FontSize = 18.5;
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
this.Content_1.FontSize = 13.5;
|
||||
//}
|
||||
|
||||
this.Content_1.VerticalOptions = LayoutOptions.Center;
|
||||
this.btnGenerate.VerticalOptions = LayoutOptions.Center;
|
||||
}
|
||||
}
|
||||
void OnButtonClicked(object sender, EventArgs e)
|
||||
{
|
||||
Assembly assembly = typeof(BookmarkNavigation).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();
|
||||
#if COMMONSB
|
||||
string rootPath = "SampleBrowser.Samples.DocIO.Samples.Templates.";
|
||||
#else
|
||||
string rootPath = "SampleBrowser.DocIO.Samples.Templates.";
|
||||
#endif
|
||||
Stream inputStream = assembly.GetManifestResourceStream(rootPath + "Bookmark_Template.doc");
|
||||
// Open an existing template document.
|
||||
nwdInformation.Open(inputStream, FormatType.Doc);
|
||||
inputStream.Dispose();
|
||||
// Open an existing template document with multiple section.
|
||||
WordDocument templateDocument = new WordDocument();
|
||||
inputStream = assembly.GetManifestResourceStream(rootPath + "BkmkDocumentPart_Template.doc");
|
||||
// Open an existing template document.
|
||||
templateDocument.Open(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);
|
||||
// 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
|
||||
bk.MoveToBookmark("Image");
|
||||
bk.DeleteBookmarkContent(true);
|
||||
// Inserting image to the bookmark.
|
||||
IWPicture pic = bk.InsertParagraphItem(ParagraphItemType.Picture) as WPicture;
|
||||
inputStream = assembly.GetManifestResourceStream(rootPath + "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.
|
||||
|
||||
|
||||
#region Saving Document
|
||||
MemoryStream stream = new MemoryStream();
|
||||
document.Save(stream, FormatType.Word2013);
|
||||
document.Close();
|
||||
if (Device.RuntimePlatform == Device.UWP)
|
||||
Xamarin.Forms.DependencyService.Get<ISaveWindowsPhone>().Save("BookMarkNavigation.docx", "application/msword", stream);
|
||||
else
|
||||
Xamarin.Forms.DependencyService.Get<ISave>().Save("BookMarkNavigation.docx", "application/msword", stream);
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<local:SampleView
|
||||
xmlns:local="clr-namespace:SampleBrowser.Core;assembly=SampleBrowser.Core"
|
||||
xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="SampleBrowser.DocIO.BuiltInStyle">
|
||||
|
||||
<local:SampleView.Content>
|
||||
<StackLayout Padding ="10">
|
||||
|
||||
|
||||
<Label x:Name="Content_1" Text="This sample illustrates how to format the Word document contents with the built-in styles."
|
||||
FontSize="Medium" VerticalOptions="Center">
|
||||
</Label>
|
||||
|
||||
<Label></Label>
|
||||
|
||||
<Button x:Name="btnGenerate" Clicked ="OnButtonClicked" Text ="Generate Word" HorizontalOptions="Center" VerticalOptions="Center"></Button>
|
||||
</StackLayout>
|
||||
</local:SampleView.Content>
|
||||
<local:SampleView.PropertyView>
|
||||
|
||||
</local:SampleView.PropertyView>
|
||||
|
||||
</local:SampleView>
|
|
@ -0,0 +1,252 @@
|
|||
#region Copyright Syncfusion Inc. 2001-2019.
|
||||
// Copyright Syncfusion Inc. 2001-2019. 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.DocIO;
|
||||
using SampleBrowser.Core;
|
||||
using Syncfusion.DocIO.DLS;
|
||||
using System;
|
||||
using System.IO;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace SampleBrowser.DocIO
|
||||
{
|
||||
public partial class BuiltInStyle : SampleView
|
||||
{
|
||||
public BuiltInStyle()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
if (Device.Idiom != TargetIdiom.Phone && Device.RuntimePlatform == Device.UWP)
|
||||
{
|
||||
|
||||
this.Content_1.HorizontalOptions = LayoutOptions.Start;
|
||||
this.btnGenerate.HorizontalOptions = LayoutOptions.Start;
|
||||
|
||||
|
||||
this.Content_1.VerticalOptions = LayoutOptions.Center;
|
||||
this.btnGenerate.VerticalOptions = LayoutOptions.Center;
|
||||
this.btnGenerate.BackgroundColor = Color.Gray;
|
||||
}
|
||||
else if (Device.Idiom == TargetIdiom.Phone && Device.RuntimePlatform == Device.UWP)
|
||||
{
|
||||
//if (!SampleBrowser.DocIO.App.isUWP)
|
||||
//{
|
||||
// this.Content_1.FontSize = 18.5;
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
this.Content_1.FontSize = 13.5;
|
||||
//}
|
||||
|
||||
this.Content_1.VerticalOptions = LayoutOptions.Center;
|
||||
this.btnGenerate.VerticalOptions = LayoutOptions.Center;
|
||||
}
|
||||
}
|
||||
void OnButtonClicked(object sender, EventArgs e)
|
||||
{
|
||||
// Creating a new document.
|
||||
WordDocument document = new WordDocument();
|
||||
|
||||
|
||||
WSection section = document.AddSection() as WSection;
|
||||
//Set Margin of the section
|
||||
section.PageSetup.Margins.All = 72;
|
||||
WParagraph para = section.AddParagraph() as WParagraph;
|
||||
section.AddColumn(100, 100);
|
||||
section.AddColumn(100, 100);
|
||||
section.MakeColumnsEqual();
|
||||
|
||||
#region Built-in styles
|
||||
# region List Style
|
||||
|
||||
//List
|
||||
//para = section.AddParagraph() as WParagraph;
|
||||
para.AppendText("This para is written with style List").CharacterFormat.UnderlineStyle = Syncfusion.Drawing.UnderlineStyle.Double;
|
||||
para = section.AddParagraph() as WParagraph;
|
||||
para.ApplyStyle(BuiltinStyle.List);
|
||||
para.AppendText("Google Chrome\n");
|
||||
para.AppendText("Mozilla Firefox\n");
|
||||
para.AppendText("Internet Explorer");
|
||||
|
||||
//List5 style
|
||||
para = section.AddParagraph() as WParagraph;
|
||||
para.AppendText("\nThis para is written with style List5").CharacterFormat.UnderlineStyle = Syncfusion.Drawing.UnderlineStyle.Double;
|
||||
para = section.AddParagraph() as WParagraph;
|
||||
para.ApplyStyle(BuiltinStyle.List5);
|
||||
para.AppendText("Google Chrome\n");
|
||||
para.AppendText("Mozilla Firefox\n");
|
||||
para.AppendText("Internet Explorer");
|
||||
|
||||
# endregion
|
||||
|
||||
# region ListNumber Style
|
||||
|
||||
//List Number style
|
||||
para = section.AddParagraph() as WParagraph;
|
||||
para.AppendText("\nThis para is written with style ListNumber").CharacterFormat.UnderlineStyle = Syncfusion.Drawing.UnderlineStyle.Double;
|
||||
para = section.AddParagraph() as WParagraph;
|
||||
para.ApplyStyle(BuiltinStyle.ListNumber);
|
||||
para.AppendText("Google Chrome\n");
|
||||
para.AppendText("Mozilla Firefox\n");
|
||||
para.AppendText("Internet Explorer");
|
||||
|
||||
//List Number5 style
|
||||
para = section.AddParagraph() as WParagraph;
|
||||
para.AppendText("\nThis para is written with style ListNumber5").CharacterFormat.UnderlineStyle = Syncfusion.Drawing.UnderlineStyle.Double;
|
||||
para = section.AddParagraph() as WParagraph;
|
||||
para.ApplyStyle(BuiltinStyle.ListNumber5);
|
||||
para.AppendText("Google Chrome\n");
|
||||
para.AppendText("Mozilla Firefox\n");
|
||||
para.AppendText("Internet Explorer");
|
||||
|
||||
# endregion
|
||||
|
||||
# region TOA Heading Style
|
||||
|
||||
//TOA Heading
|
||||
para = section.AddParagraph() as WParagraph;
|
||||
para.AppendText("\nThis para is written with style TOA Heading").CharacterFormat.UnderlineStyle = Syncfusion.Drawing.UnderlineStyle.Double;
|
||||
para = section.AddParagraph() as WParagraph;
|
||||
para.ApplyStyle(BuiltinStyle.ToaHeading);
|
||||
para.AppendText("Google Chrome\n");
|
||||
para.AppendText("Mozilla Firefox\n");
|
||||
para.AppendText("Internet Explorer");
|
||||
|
||||
# endregion
|
||||
|
||||
para = section.AddParagraph() as WParagraph;
|
||||
section.BreakCode = SectionBreakCode.NewColumn;
|
||||
|
||||
# region ListBullet Style
|
||||
//ListBullet
|
||||
para = section.AddParagraph() as WParagraph;
|
||||
para.AppendText("\nThis para is written with style ListBullet").CharacterFormat.UnderlineStyle = Syncfusion.Drawing.UnderlineStyle.Double;
|
||||
para = section.AddParagraph() as WParagraph;
|
||||
para.ApplyStyle(BuiltinStyle.ListBullet);
|
||||
para.AppendText("Google Chrome\n");
|
||||
para.AppendText("Mozilla Firefox\n");
|
||||
para.AppendText("Internet Explorer");
|
||||
|
||||
//ListBullet5
|
||||
para = section.AddParagraph() as WParagraph;
|
||||
para.AppendText("\nThis para is written with style ListBullet5").CharacterFormat.UnderlineStyle = Syncfusion.Drawing.UnderlineStyle.Double;
|
||||
para = section.AddParagraph() as WParagraph;
|
||||
para.ApplyStyle(BuiltinStyle.ListBullet5);
|
||||
para.AppendText("Google Chrome\n");
|
||||
para.AppendText("Mozilla Firefox\n");
|
||||
para.AppendText("Internet Explorer");
|
||||
|
||||
# endregion
|
||||
|
||||
# region List Continue Style
|
||||
|
||||
//ListContinue
|
||||
para = section.AddParagraph() as WParagraph;
|
||||
para.AppendText("\nThis para is written with style ListContinue").CharacterFormat.UnderlineStyle = Syncfusion.Drawing.UnderlineStyle.Double;
|
||||
para = section.AddParagraph() as WParagraph;
|
||||
para.ApplyStyle(BuiltinStyle.ListContinue);
|
||||
para.AppendText("Google Chrome\n");
|
||||
para.AppendText("Mozilla Firefox\n");
|
||||
para.AppendText("Internet Explorer");
|
||||
|
||||
//ListContinue5
|
||||
para = section.AddParagraph() as WParagraph;
|
||||
para.AppendText("\nThis para is written with style ListContinue5").CharacterFormat.UnderlineStyle = Syncfusion.Drawing.UnderlineStyle.Double;
|
||||
para = section.AddParagraph() as WParagraph;
|
||||
para.ApplyStyle(BuiltinStyle.ListContinue5);
|
||||
para.AppendText("Google Chrome\n");
|
||||
para.AppendText("Mozilla Firefox\n");
|
||||
para.AppendText("Internet Explorer");
|
||||
|
||||
# endregion
|
||||
|
||||
# region HTMLSample Style
|
||||
|
||||
//HtmlSample
|
||||
para = section.AddParagraph() as WParagraph;
|
||||
para.AppendText("\nThis para is written with style HtmlSample").CharacterFormat.UnderlineStyle = Syncfusion.Drawing.UnderlineStyle.Double;
|
||||
para = section.AddParagraph() as WParagraph;
|
||||
para.ApplyStyle(BuiltinStyle.HtmlSample);
|
||||
para.AppendText("Google Chrome\n");
|
||||
para.AppendText("Mozilla Firefox\n");
|
||||
para.AppendText("Internet Explorer");
|
||||
|
||||
# endregion
|
||||
|
||||
section = document.AddSection() as WSection;
|
||||
section.BreakCode = SectionBreakCode.NoBreak;
|
||||
|
||||
# region Document Map Style
|
||||
|
||||
//Docuemnt Map
|
||||
para = section.AddParagraph() as WParagraph;
|
||||
para.AppendText("This para is written with style DocumentMap\n").CharacterFormat.UnderlineStyle = Syncfusion.Drawing.UnderlineStyle.Double;
|
||||
para = section.AddParagraph() as WParagraph;
|
||||
para.ApplyStyle(BuiltinStyle.DocumentMap);
|
||||
IWTextRange textrange = para.AppendText("Google Chrome\n");
|
||||
textrange.CharacterFormat.TextBackgroundColor = Syncfusion.Drawing.Color.Red;
|
||||
textrange = para.AppendText("Mozilla Firefox\n");
|
||||
textrange.CharacterFormat.TextBackgroundColor = Syncfusion.Drawing.Color.Red;
|
||||
textrange = para.AppendText("Internet Explorer");
|
||||
textrange.CharacterFormat.TextBackgroundColor = Syncfusion.Drawing.Color.Red;
|
||||
|
||||
#endregion
|
||||
|
||||
# region Heading Styles
|
||||
//Heading Styles
|
||||
para = section.AddParagraph() as WParagraph;
|
||||
para.ApplyStyle(BuiltinStyle.Heading1);
|
||||
para.AppendText("Hello World. This para is written with style " + para.StyleName.ToString());
|
||||
|
||||
para = section.AddParagraph() as WParagraph;
|
||||
para.ApplyStyle(BuiltinStyle.Heading2);
|
||||
para.AppendText("Hello World. This para is written with style " + para.StyleName.ToString());
|
||||
|
||||
para = section.AddParagraph() as WParagraph;
|
||||
para.ApplyStyle(BuiltinStyle.Heading3);
|
||||
para.AppendText("Hello World. This para is written with style " + para.StyleName.ToString());
|
||||
|
||||
para = section.AddParagraph() as WParagraph;
|
||||
para.ApplyStyle(BuiltinStyle.Heading4);
|
||||
para.AppendText("Hello World. This para is written with style " + para.StyleName.ToString());
|
||||
|
||||
para = section.AddParagraph() as WParagraph;
|
||||
para.ApplyStyle(BuiltinStyle.Heading5);
|
||||
para.AppendText("Hello World. This para is written with style " + para.StyleName.ToString());
|
||||
|
||||
para = section.AddParagraph() as WParagraph;
|
||||
para.ApplyStyle(BuiltinStyle.Heading6);
|
||||
para.AppendText("Hello World. This para is written with style " + para.StyleName.ToString());
|
||||
|
||||
para = section.AddParagraph() as WParagraph;
|
||||
para.ApplyStyle(BuiltinStyle.Heading7);
|
||||
para.AppendText("Hello World. This para is written with style " + para.StyleName.ToString());
|
||||
|
||||
para = section.AddParagraph() as WParagraph;
|
||||
para.ApplyStyle(BuiltinStyle.Heading8);
|
||||
para.AppendText("Hello World. This para is written with style " + para.StyleName.ToString());
|
||||
|
||||
para = section.AddParagraph() as WParagraph;
|
||||
para.ApplyStyle(BuiltinStyle.Heading9);
|
||||
para.AppendText("Hello World. This para is written with style " + para.StyleName.ToString());
|
||||
|
||||
# endregion
|
||||
|
||||
#endregion Built-in styles
|
||||
|
||||
#region Saving Document
|
||||
MemoryStream stream = new MemoryStream();
|
||||
document.Save(stream, FormatType.Word2013);
|
||||
document.Close();
|
||||
if (Device.RuntimePlatform == Device.UWP)
|
||||
Xamarin.Forms.DependencyService.Get<ISaveWindowsPhone>().Save("WordDocument_BuiltInStyles.docx", "application/msword", stream);
|
||||
else
|
||||
Xamarin.Forms.DependencyService.Get<ISave>().Save("WordDocument_BuiltInStyles.docx", "application/msword", stream);
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<local:SampleView
|
||||
xmlns:local="clr-namespace:SampleBrowser.Core;assembly=SampleBrowser.Core"
|
||||
xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="SampleBrowser.DocIO.CustomStyle">
|
||||
|
||||
<local:SampleView.Content>
|
||||
<StackLayout Padding ="10">
|
||||
|
||||
<Label x:Name="Content_1" Text="This sample illustrates how to format the Word document contents with user defined styles." FontSize="Medium" VerticalOptions="Center">
|
||||
</Label>
|
||||
|
||||
<Label></Label>
|
||||
|
||||
<Button x:Name="btnGenerate" Clicked ="OnButtonClicked" Text ="Generate Word" HorizontalOptions="Center" VerticalOptions="Center"></Button>
|
||||
</StackLayout>
|
||||
</local:SampleView.Content>
|
||||
<local:SampleView.PropertyView>
|
||||
|
||||
</local:SampleView.PropertyView>
|
||||
|
||||
</local:SampleView>
|
|
@ -0,0 +1,122 @@
|
|||
#region Copyright Syncfusion Inc. 2001-2019.
|
||||
// Copyright Syncfusion Inc. 2001-2019. 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.DocIO;
|
||||
using SampleBrowser.Core;
|
||||
using Syncfusion.DocIO.DLS;
|
||||
using System;
|
||||
using System.IO;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace SampleBrowser.DocIO
|
||||
{
|
||||
public partial class CustomStyle : SampleView
|
||||
{
|
||||
public CustomStyle()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
if (Device.Idiom != TargetIdiom.Phone && Device.RuntimePlatform == Device.UWP)
|
||||
{
|
||||
|
||||
this.Content_1.HorizontalOptions = LayoutOptions.Start;
|
||||
this.btnGenerate.HorizontalOptions = LayoutOptions.Start;
|
||||
|
||||
|
||||
this.Content_1.VerticalOptions = LayoutOptions.Center;
|
||||
this.btnGenerate.VerticalOptions = LayoutOptions.Center;
|
||||
this.btnGenerate.BackgroundColor = Color.Gray;
|
||||
}
|
||||
else if (Device.Idiom == TargetIdiom.Phone && Device.RuntimePlatform == Device.UWP)
|
||||
{
|
||||
// if (!SampleBrowser.DocIO.App.isUWP)
|
||||
//{
|
||||
// this.Content_1.FontSize = 18.5;
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
this.Content_1.FontSize = 13.5;
|
||||
//}
|
||||
|
||||
this.Content_1.VerticalOptions = LayoutOptions.Center;
|
||||
this.btnGenerate.VerticalOptions = LayoutOptions.Center;
|
||||
}
|
||||
}
|
||||
void OnButtonClicked(object sender, EventArgs e)
|
||||
{
|
||||
WordDocument document = new WordDocument();
|
||||
IWParagraphStyle style = null;
|
||||
// Adding a new section to the document.
|
||||
WSection section = document.AddSection() as WSection;
|
||||
//Set Margin of the section
|
||||
section.PageSetup.Margins.All = 72;
|
||||
IWParagraph par = document.LastSection.AddParagraph();
|
||||
WTextRange range = par.AppendText("Using CustomStyles") as WTextRange;
|
||||
range.CharacterFormat.TextBackgroundColor = Syncfusion.Drawing.Color.Red;
|
||||
range.CharacterFormat.TextColor = Syncfusion.Drawing.Color.White;
|
||||
range.CharacterFormat.FontSize = 18f;
|
||||
document.LastParagraph.ParagraphFormat.HorizontalAlignment = Syncfusion.DocIO.DLS.HorizontalAlignment.Center;
|
||||
|
||||
// Create Paragraph styles
|
||||
style = document.AddParagraphStyle("MyStyle_Normal");
|
||||
style.CharacterFormat.FontName = "Bitstream Vera Serif";
|
||||
style.CharacterFormat.FontSize = 10f;
|
||||
style.ParagraphFormat.HorizontalAlignment = Syncfusion.DocIO.DLS.HorizontalAlignment.Justify;
|
||||
style.CharacterFormat.TextColor = Syncfusion.Drawing.Color.FromArgb(0, 21, 84);
|
||||
|
||||
style = document.AddParagraphStyle("MyStyle_Low");
|
||||
style.CharacterFormat.FontName = "Times New Roman";
|
||||
style.CharacterFormat.FontSize = 16f;
|
||||
style.CharacterFormat.Bold = true;
|
||||
|
||||
style = document.AddParagraphStyle("MyStyle_Medium");
|
||||
style.CharacterFormat.FontName = "Monotype Corsiva";
|
||||
style.CharacterFormat.FontSize = 18f;
|
||||
style.CharacterFormat.Bold = true;
|
||||
style.CharacterFormat.TextColor = Syncfusion.Drawing.Color.FromArgb(51, 66, 125);
|
||||
|
||||
style = document.AddParagraphStyle("Mystyle_High");
|
||||
style.CharacterFormat.FontName = "Bitstream Vera Serif";
|
||||
style.CharacterFormat.FontSize = 20f;
|
||||
style.CharacterFormat.Bold = true;
|
||||
style.CharacterFormat.TextColor = Syncfusion.Drawing.Color.FromArgb(242, 151, 50);
|
||||
|
||||
IWParagraph paragraph = null;
|
||||
for (int i = 1; i < document.Styles.Count; i++)
|
||||
{
|
||||
//Skip to apply the document default styles and also paragraph style.
|
||||
if(document.Styles[i].Name=="Normal"||document.Styles[i].Name=="Default Paragraph Font"||document.Styles[i].StyleType!=StyleType.ParagraphStyle)
|
||||
continue;
|
||||
// Getting styles from Document.
|
||||
style = (IWParagraphStyle)document.Styles[i];
|
||||
// Adding a new paragraph
|
||||
section.AddParagraph();
|
||||
paragraph = section.AddParagraph();
|
||||
// Applying styles to the current paragraph.
|
||||
paragraph.ApplyStyle(style.Name);
|
||||
// Writing Text with the current style and formatting.
|
||||
paragraph.AppendText("Northwind Database with [" + style.Name + "] Style");
|
||||
// Adding a new paragraph
|
||||
section.AddParagraph();
|
||||
paragraph = section.AddParagraph();
|
||||
// Applying another style to the current paragraph.
|
||||
paragraph.ApplyStyle("MyStyle_Normal");
|
||||
// Writing text with current style.
|
||||
paragraph.AppendText("The Northwind sample database (Northwind.mdb) is included with all versions of Access. It provides data you can experiment with and database objects that illustrate features you might want to implement in your own databases. Using Northwind, you can become familiar with how a relational database is structured and how the database objects work together to help you enter, store, manipulate, and print your data.");
|
||||
}
|
||||
#region Saving Document
|
||||
MemoryStream stream = new MemoryStream();
|
||||
document.Save(stream, FormatType.Word2013);
|
||||
document.Close();
|
||||
if (Device.RuntimePlatform == Device.UWP)
|
||||
Xamarin.Forms.DependencyService.Get<ISaveWindowsPhone>().Save("WordDocument_CustomStyles.docx", "application/msword", stream);
|
||||
else
|
||||
Xamarin.Forms.DependencyService.Get<ISave>().Save("WordDocument_CustomStyles.docx", "application/msword", stream);
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<local:SampleView
|
||||
xmlns:local="clr-namespace:SampleBrowser.Core;assembly=SampleBrowser.Core"
|
||||
xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="SampleBrowser.DocIO.DocIO_BarChart">
|
||||
|
||||
<local:SampleView.Content>
|
||||
<StackLayout Padding ="10">
|
||||
|
||||
|
||||
|
||||
<Label x:Name="Content_1" Text="This sample illustrates how to create a bar chart in a Word document with the data from an existing Excel file."
|
||||
FontSize="Medium" VerticalOptions="Center">
|
||||
</Label>
|
||||
|
||||
<Label></Label>
|
||||
|
||||
<Button x:Name="btnGenerate" Clicked ="OnButtonClicked" Text ="Generate Word" HorizontalOptions="Center" VerticalOptions="Center"></Button>
|
||||
</StackLayout>
|
||||
</local:SampleView.Content>
|
||||
<local:SampleView.PropertyView>
|
||||
|
||||
</local:SampleView.PropertyView>
|
||||
|
||||
</local:SampleView>
|
|
@ -0,0 +1,118 @@
|
|||
#region Copyright Syncfusion Inc. 2001-2019.
|
||||
// Copyright Syncfusion Inc. 2001-2019. 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 SampleBrowser.Core;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using Syncfusion.DocIO.DLS;
|
||||
using Syncfusion.DocIO;
|
||||
using Syncfusion.OfficeChart;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace SampleBrowser.DocIO
|
||||
{
|
||||
public partial class DocIO_BarChart : SampleView
|
||||
{
|
||||
public DocIO_BarChart()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
if (Device.Idiom != TargetIdiom.Phone && Device.RuntimePlatform == Device.UWP)
|
||||
{
|
||||
|
||||
this.Content_1.HorizontalOptions = LayoutOptions.Start;
|
||||
this.btnGenerate.HorizontalOptions = LayoutOptions.Start;
|
||||
|
||||
|
||||
this.Content_1.VerticalOptions = LayoutOptions.Center;
|
||||
this.btnGenerate.VerticalOptions = LayoutOptions.Center;
|
||||
this.btnGenerate.BackgroundColor = Xamarin.Forms.Color.Gray;
|
||||
}
|
||||
else if (Device.Idiom == TargetIdiom.Phone && Device.RuntimePlatform == Device.UWP)
|
||||
{
|
||||
//if (!SampleBrowser.DocIO.App.isUWP)
|
||||
//{
|
||||
// this.Content_1.FontSize = 18.5;
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
this.Content_1.FontSize = 13.5;
|
||||
//}
|
||||
|
||||
this.Content_1.VerticalOptions = LayoutOptions.Center;
|
||||
this.btnGenerate.VerticalOptions = LayoutOptions.Center;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnButtonClicked(object sender, EventArgs e)
|
||||
{
|
||||
Assembly assembly = typeof(DocIO_BarChart).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 = HorizontalAlignment.Center;
|
||||
//Append text to the paragraph
|
||||
paragraph.AppendText("Northwind Management Report").CharacterFormat.TextColor = Syncfusion.Drawing.Color.FromArgb(46, 116, 181);
|
||||
//Add new paragraph
|
||||
paragraph = section.AddParagraph();
|
||||
//Set before spacing to the paragraph
|
||||
paragraph.ParagraphFormat.BeforeSpacing = 20;
|
||||
#if COMMONSB
|
||||
string rootPath = "SampleBrowser.Samples.DocIO.Samples.Templates.";
|
||||
#else
|
||||
string rootPath = "SampleBrowser.DocIO.Samples.Templates.";
|
||||
#endif
|
||||
//Load the excel template as stream
|
||||
Stream excelStream = assembly.GetManifestResourceStream(rootPath + "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
|
||||
MemoryStream stream = new MemoryStream();
|
||||
document.Save(stream, FormatType.Word2013);
|
||||
document.Close();
|
||||
if (Device.RuntimePlatform == Device.UWP)
|
||||
Xamarin.Forms.DependencyService.Get<ISaveWindowsPhone>().Save("BarChart.docx", "application/msword", stream);
|
||||
else
|
||||
Xamarin.Forms.DependencyService.Get<ISave>().Save("BarChart.docx", "application/msword", stream);
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<local:SampleView
|
||||
xmlns:local="clr-namespace:SampleBrowser.Core;assembly=SampleBrowser.Core"
|
||||
xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="SampleBrowser.DocIO.DocIO_PieChart">
|
||||
|
||||
<local:SampleView.Content>
|
||||
<StackLayout Padding ="10">
|
||||
|
||||
|
||||
<Label x:Name="Content_1" Text="This sample illustrates how to create a pie chart in a Word document."
|
||||
FontSize="Medium" VerticalOptions="Center">
|
||||
</Label>
|
||||
|
||||
<Label></Label>
|
||||
|
||||
<Button x:Name="btnGenerate" Clicked ="OnButtonClicked" Text ="Generate Word" HorizontalOptions="Center" VerticalOptions="Center"></Button>
|
||||
</StackLayout>
|
||||
</local:SampleView.Content>
|
||||
<local:SampleView.PropertyView>
|
||||
|
||||
</local:SampleView.PropertyView>
|
||||
|
||||
</local:SampleView>
|
|
@ -0,0 +1,203 @@
|
|||
#region Copyright Syncfusion Inc. 2001-2019.
|
||||
// Copyright Syncfusion Inc. 2001-2019. 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 SampleBrowser.Core;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using Syncfusion.DocIO;
|
||||
using Syncfusion.DocIO.DLS;
|
||||
using Syncfusion.OfficeChart;
|
||||
using Xamarin.Forms;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace SampleBrowser.DocIO
|
||||
{
|
||||
public partial class DocIO_PieChart : SampleView
|
||||
{
|
||||
public DocIO_PieChart()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
if (Device.Idiom != TargetIdiom.Phone && Device.RuntimePlatform == Device.UWP)
|
||||
{
|
||||
|
||||
this.Content_1.HorizontalOptions = LayoutOptions.Start;
|
||||
this.btnGenerate.HorizontalOptions = LayoutOptions.Start;
|
||||
|
||||
|
||||
this.Content_1.VerticalOptions = LayoutOptions.Center;
|
||||
this.btnGenerate.VerticalOptions = LayoutOptions.Center;
|
||||
this.btnGenerate.BackgroundColor = Xamarin.Forms.Color.Gray;
|
||||
}
|
||||
else if (Device.Idiom == TargetIdiom.Phone && Device.RuntimePlatform == Device.UWP)
|
||||
{
|
||||
//if (!SampleBrowser.DocIO.App.isUWP)
|
||||
// {
|
||||
// this.Content_1.FontSize = 18.5;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
this.Content_1.FontSize = 13.5;
|
||||
//}
|
||||
|
||||
this.Content_1.VerticalOptions = LayoutOptions.Center;
|
||||
this.btnGenerate.VerticalOptions = LayoutOptions.Center;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void OnButtonClicked(object sender, EventArgs e)
|
||||
{
|
||||
Assembly assembly = typeof(DocIO_PieChart).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 = HorizontalAlignment.Center;
|
||||
//Append text to the paragraph
|
||||
paragraph.AppendText("Northwind Management Report").CharacterFormat.TextColor = Syncfusion.Drawing.Color.FromArgb(46, 116, 181);
|
||||
//Add new paragraph
|
||||
paragraph = section.AddParagraph();
|
||||
//Get chart data from xml file
|
||||
List<ProductDetail> Products = LoadXMLData();
|
||||
//Create and Append chart to the paragraph
|
||||
WChart pieChart = document.LastParagraph.AppendChart(446, 270);
|
||||
//Set chart data
|
||||
pieChart.ChartType = OfficeChartType.Pie;
|
||||
pieChart.ChartTitle = "Best Selling Products";
|
||||
pieChart.ChartTitleArea.FontName = "Calibri (Body)";
|
||||
pieChart.ChartTitleArea.Size = 14;
|
||||
for (int i = 0; i < Products.Count; i++)
|
||||
{
|
||||
ProductDetail product = Products[i];
|
||||
pieChart.ChartData.SetValue(i + 2, 1, product.ProductName);
|
||||
pieChart.ChartData.SetValue(i + 2, 2, product.Sum);
|
||||
}
|
||||
//Create a new chart series with the name “Sales”
|
||||
IOfficeChartSerie pieSeries = pieChart.Series.Add("Sales");
|
||||
pieSeries.Values = pieChart.ChartData[2, 2, 11, 2];
|
||||
//Setting data label
|
||||
pieSeries.DataPoints.DefaultDataPoint.DataLabels.IsPercentage = true;
|
||||
pieSeries.DataPoints.DefaultDataPoint.DataLabels.Position = OfficeDataLabelPosition.Outside;
|
||||
//Setting background color
|
||||
pieChart.ChartArea.Fill.ForeColor = Syncfusion.Drawing.Color.FromArgb(242, 242, 242);
|
||||
pieChart.PlotArea.Fill.ForeColor = Syncfusion.Drawing.Color.FromArgb(242, 242, 242);
|
||||
pieChart.ChartArea.Border.LinePattern = OfficeChartLinePattern.None;
|
||||
pieChart.PrimaryCategoryAxis.CategoryLabels = pieChart.ChartData[2, 1, 11, 1];
|
||||
MemoryStream stream = new MemoryStream();
|
||||
document.Save(stream, FormatType.Word2013);
|
||||
document.Close();
|
||||
|
||||
if (Device.RuntimePlatform == Device.UWP)
|
||||
Xamarin.Forms.DependencyService.Get<ISaveWindowsPhone>()
|
||||
.Save("PieChart.docx", "application/msword", stream);
|
||||
else
|
||||
Xamarin.Forms.DependencyService.Get<ISave>().Save("PieChart.docx", "application/msword", stream);
|
||||
}
|
||||
|
||||
private List<ProductDetail> LoadXMLData()
|
||||
{
|
||||
XDocument productXml;
|
||||
List<ProductDetail> Products = new List<ProductDetail>();
|
||||
ProductDetail productDetails;
|
||||
Assembly assembly = typeof(DocIO_PieChart).GetTypeInfo().Assembly;
|
||||
#if COMMONSB
|
||||
string rootPath = "SampleBrowser.Samples.DocIO.Samples.Templates.";
|
||||
#else
|
||||
string rootPath = "SampleBrowser.DocIO.Samples.Templates.";
|
||||
#endif
|
||||
Stream productXMLStream = assembly.GetManifestResourceStream(rootPath + "Products.xml");
|
||||
productXml = XDocument.Load(productXMLStream);
|
||||
IEnumerable<XElement> pc = from p in productXml.Descendants("Product") select p;
|
||||
string serailNo = string.Empty;
|
||||
string productName = string.Empty;
|
||||
string sum = string.Empty;
|
||||
foreach (XElement dt in pc)
|
||||
{
|
||||
|
||||
foreach (XElement el in dt.Descendants())
|
||||
{
|
||||
var xElement = dt.Element(el.Name);
|
||||
if (xElement != null)
|
||||
{
|
||||
string value = xElement.Value;
|
||||
string elementName = el.Name.ToString();
|
||||
switch (elementName)
|
||||
{
|
||||
case "SNO":
|
||||
serailNo = value;
|
||||
break;
|
||||
case "ProductName":
|
||||
productName = value;
|
||||
break;
|
||||
case "Sum":
|
||||
sum = value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
productDetails = new ProductDetail(int.Parse(serailNo), productName, decimal.Parse(sum));
|
||||
Products.Add(productDetails);
|
||||
}
|
||||
return Products;
|
||||
}
|
||||
}
|
||||
|
||||
public class ProductDetail
|
||||
{
|
||||
#region fields
|
||||
|
||||
private int m_serialNo;
|
||||
private string m_productName;
|
||||
private decimal m_sum;
|
||||
|
||||
#endregion
|
||||
|
||||
#region properties
|
||||
|
||||
public int SNO
|
||||
{
|
||||
get { return m_serialNo; }
|
||||
set { m_serialNo = value; }
|
||||
}
|
||||
|
||||
public string ProductName
|
||||
{
|
||||
get { return m_productName; }
|
||||
set { m_productName = value; }
|
||||
}
|
||||
|
||||
public decimal Sum
|
||||
{
|
||||
get { return m_sum; }
|
||||
set { m_sum = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructor
|
||||
|
||||
public ProductDetail(int serialNumber, string productName, decimal sum)
|
||||
{
|
||||
SNO = serialNumber;
|
||||
ProductName = productName;
|
||||
Sum = Math.Round(sum, 3);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<local:SampleView
|
||||
xmlns:local="clr-namespace:SampleBrowser.Core;assembly=SampleBrowser.Core"
|
||||
xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="SampleBrowser.DocIO.FormFillingAndProtection">
|
||||
|
||||
<local:SampleView.Content>
|
||||
<StackLayout Padding ="10">
|
||||
|
||||
<Label x:Name="Content_1" Text="This sample illustrates how to fill data and protect the content controls in an existing Word document."
|
||||
FontSize="Medium" VerticalOptions="Center">
|
||||
</Label>
|
||||
|
||||
<Label></Label>
|
||||
|
||||
<Button x:Name="btnGenerate" Clicked ="OnButtonClicked" Text ="Generate Word" HorizontalOptions="Center" VerticalOptions="Center"></Button>
|
||||
</StackLayout>
|
||||
</local:SampleView.Content>
|
||||
<local:SampleView.PropertyView>
|
||||
|
||||
</local:SampleView.PropertyView>
|
||||
|
||||
</local:SampleView>
|
|
@ -0,0 +1,236 @@
|
|||
#region Copyright Syncfusion Inc. 2001-2019.
|
||||
// Copyright Syncfusion Inc. 2001-2019. 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.IO;
|
||||
using System.Reflection;
|
||||
using SampleBrowser.Core;
|
||||
using Syncfusion.DocIO;
|
||||
using Syncfusion.DocIO.DLS;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace SampleBrowser.DocIO
|
||||
{
|
||||
/// <summary>
|
||||
/// A sample view that can be used on FormFillingAndProtection.
|
||||
/// </summary>
|
||||
public partial class FormFillingAndProtection : SampleView
|
||||
{
|
||||
/// <summary>
|
||||
/// Constructor for FormFillingAndProtection.
|
||||
/// </summary>
|
||||
public FormFillingAndProtection()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
if (Device.Idiom != TargetIdiom.Phone && Device.RuntimePlatform == Device.UWP)
|
||||
{
|
||||
|
||||
this.Content_1.HorizontalOptions = LayoutOptions.Start;
|
||||
this.btnGenerate.HorizontalOptions = LayoutOptions.Start;
|
||||
|
||||
|
||||
this.Content_1.VerticalOptions = LayoutOptions.Center;
|
||||
this.btnGenerate.VerticalOptions = LayoutOptions.Center;
|
||||
this.btnGenerate.BackgroundColor = Xamarin.Forms.Color.Gray;
|
||||
}
|
||||
else if (Device.Idiom == TargetIdiom.Phone && Device.RuntimePlatform == Device.UWP)
|
||||
{
|
||||
//if (!SampleBrowser.DocIO.App.isUWP)
|
||||
//{
|
||||
// this.Content_1.FontSize = 18.5;
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
this.Content_1.FontSize = 13.5;
|
||||
// }
|
||||
|
||||
this.Content_1.VerticalOptions = LayoutOptions.Center;
|
||||
this.btnGenerate.VerticalOptions = LayoutOptions.Center;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Button click event for FormFillingAndProtection.
|
||||
/// </summary>
|
||||
/// <param name="sender">Sender</param>
|
||||
/// <param name="e">Event args</param>
|
||||
private void OnButtonClicked(object sender, EventArgs e)
|
||||
{
|
||||
#if COMMONSB
|
||||
string rootPath = "SampleBrowser.Samples.DocIO.Samples.Templates.";
|
||||
#else
|
||||
string rootPath = "SampleBrowser.DocIO.Samples.Templates.";
|
||||
#endif
|
||||
// Load Template document stream.
|
||||
Stream inputStream = typeof(FormFillingAndProtection).GetTypeInfo().Assembly.GetManifestResourceStream(rootPath + "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
|
||||
|
||||
MemoryStream stream = new MemoryStream();
|
||||
document.Save(stream, FormatType.Docx);
|
||||
document.Close();
|
||||
|
||||
if (Device.RuntimePlatform == Device.UWP)
|
||||
DependencyService.Get<ISaveWindowsPhone>()
|
||||
.Save("FormFillingAndProtection.docx", "application/msword", stream);
|
||||
else
|
||||
DependencyService.Get<ISave>().Save("FormFillingAndProtection.docx", "application/msword", stream);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<local:SampleView
|
||||
xmlns:local="clr-namespace:SampleBrowser.Core;assembly=SampleBrowser.Core"
|
||||
xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="SampleBrowser.DocIO.GettingStartedDocIO">
|
||||
|
||||
<local:SampleView.Content>
|
||||
<StackLayout Padding ="10">
|
||||
|
||||
|
||||
<Label x:Name="Content_1" Text="This sample illustrates how to create simple Word document with text, images and tables."
|
||||
FontSize="Medium" VerticalOptions="Center">
|
||||
</Label>
|
||||
|
||||
<Label></Label>
|
||||
|
||||
<Button x:Name="btnGenerate" Clicked ="OnButtonClicked" Text ="Generate Word" HorizontalOptions="Center" VerticalOptions="Center"></Button>
|
||||
</StackLayout>
|
||||
</local:SampleView.Content>
|
||||
<local:SampleView.PropertyView>
|
||||
|
||||
</local:SampleView.PropertyView>
|
||||
|
||||
</local:SampleView>
|
|
@ -0,0 +1,289 @@
|
|||
#region Copyright Syncfusion Inc. 2001-2019.
|
||||
// Copyright Syncfusion Inc. 2001-2019. 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.DocIO;
|
||||
using SampleBrowser.Core;
|
||||
using Syncfusion.DocIO.DLS;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace SampleBrowser.DocIO
|
||||
{
|
||||
public partial class GettingStartedDocIO : SampleView
|
||||
{
|
||||
public GettingStartedDocIO()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
if (Device.Idiom != TargetIdiom.Phone && Device.RuntimePlatform == Device.UWP)
|
||||
{
|
||||
|
||||
this.Content_1.HorizontalOptions = LayoutOptions.Start;
|
||||
this.btnGenerate.HorizontalOptions = LayoutOptions.Start;
|
||||
|
||||
|
||||
this.Content_1.VerticalOptions = LayoutOptions.Center;
|
||||
this.btnGenerate.VerticalOptions = LayoutOptions.Center;
|
||||
this.btnGenerate.BackgroundColor = Color.Gray;
|
||||
}
|
||||
else if (Device.Idiom == TargetIdiom.Phone && Device.RuntimePlatform == Device.UWP)
|
||||
{
|
||||
//if (!SampleBrowser.DocIO.App.isUWP)
|
||||
//{
|
||||
// this.Content_1.FontSize = 18.5;
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
this.Content_1.FontSize = 13.5;
|
||||
//}
|
||||
|
||||
this.Content_1.VerticalOptions = LayoutOptions.Center;
|
||||
this.btnGenerate.VerticalOptions = LayoutOptions.Center;
|
||||
}
|
||||
}
|
||||
void OnButtonClicked(object sender, EventArgs e)
|
||||
{
|
||||
Assembly assembly = typeof(GettingStartedDocIO).GetTypeInfo().Assembly;
|
||||
// Creating a new document.
|
||||
// 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 = new Syncfusion.Drawing.SizeF(612, 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 = Syncfusion.Drawing.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();
|
||||
#if COMMONSB
|
||||
string rootPath = "SampleBrowser.Samples.DocIO.Samples.Templates.";
|
||||
#else
|
||||
string rootPath = "SampleBrowser.DocIO.Samples.Templates.";
|
||||
#endif
|
||||
Stream imageStream = assembly.GetManifestResourceStream(rootPath + "AdventureCycle.jpg");
|
||||
WPicture picture = paragraph.AppendPicture(imageStream) as WPicture;
|
||||
picture.TextWrappingStyle = TextWrappingStyle.InFrontOfText;
|
||||
picture.VerticalOrigin = VerticalOrigin.Margin;
|
||||
picture.VerticalPosition = -24;
|
||||
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";
|
||||
textRange.CharacterFormat.TextColor = Syncfusion.Drawing.Color.Red;
|
||||
|
||||
//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 = Syncfusion.DocIO.DLS.BorderStyle.None;
|
||||
table.TableFormat.IsAutoResized = true;
|
||||
|
||||
//Appends paragraph.
|
||||
paragraph = table[0, 0].AddParagraph();
|
||||
paragraph.ParagraphFormat.AfterSpacing = 0;
|
||||
paragraph.BreakCharacterFormat.FontSize = 12f;
|
||||
imageStream = assembly.GetManifestResourceStream(rootPath + "Mountain-200.jpg");
|
||||
//Appends picture to the paragraph.
|
||||
picture = paragraph.AppendPicture(imageStream) as WPicture;
|
||||
picture.TextWrappingStyle = TextWrappingStyle.TopAndBottom;
|
||||
picture.VerticalOrigin = VerticalOrigin.Paragraph;
|
||||
picture.VerticalPosition = 0;
|
||||
picture.HorizontalOrigin = HorizontalOrigin.Column;
|
||||
picture.HorizontalPosition = -5.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;
|
||||
imageStream = assembly.GetManifestResourceStream(rootPath + "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;
|
||||
imageStream = assembly.GetManifestResourceStream(rootPath + "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 = 0;
|
||||
picture.HorizontalOrigin = HorizontalOrigin.Column;
|
||||
picture.HorizontalPosition = -4.9f;
|
||||
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();
|
||||
MemoryStream stream = new MemoryStream();
|
||||
document.Save(stream, FormatType.Word2013);
|
||||
document.Close();
|
||||
|
||||
if (Device.RuntimePlatform == Device.UWP)
|
||||
Xamarin.Forms.DependencyService.Get<ISaveWindowsPhone>().Save("GettingStarted.docx", "application/msword", stream);
|
||||
else
|
||||
Xamarin.Forms.DependencyService.Get<ISave>().Save("GettingStarted.docx", "application/msword", stream);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<local:SampleView
|
||||
xmlns:local="clr-namespace:SampleBrowser.Core;assembly=SampleBrowser.Core"
|
||||
xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="SampleBrowser.DocIO.MailMerge">
|
||||
|
||||
<local:SampleView.Content>
|
||||
<StackLayout Padding ="10">
|
||||
<Label x:Name="Content_1" Text="This sample illustrates how to create a letter format document by filling the data using Mail merge functionality of DocIO."
|
||||
FontSize="Medium" VerticalOptions="Center">
|
||||
</Label>
|
||||
|
||||
<Label></Label>
|
||||
|
||||
<Button x:Name="btnGenerate" Clicked ="OnButtonClicked" Text ="Generate Word" HorizontalOptions="Center" VerticalOptions="Center"></Button>
|
||||
</StackLayout>
|
||||
</local:SampleView.Content>
|
||||
<local:SampleView.PropertyView>
|
||||
|
||||
</local:SampleView.PropertyView>
|
||||
|
||||
</local:SampleView>
|
|
@ -0,0 +1,227 @@
|
|||
#region Copyright Syncfusion Inc. 2001-2019.
|
||||
// Copyright Syncfusion Inc. 2001-2019. 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.DocIO;
|
||||
using SampleBrowser.Core;
|
||||
using Syncfusion.DocIO.DLS;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace SampleBrowser.DocIO
|
||||
{
|
||||
public partial class MailMerge : SampleView
|
||||
{
|
||||
public MailMerge()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
if (Device.Idiom != TargetIdiom.Phone && Device.RuntimePlatform == Device.UWP)
|
||||
{
|
||||
|
||||
this.Content_1.HorizontalOptions = LayoutOptions.Start;
|
||||
this.btnGenerate.HorizontalOptions = LayoutOptions.Start;
|
||||
|
||||
|
||||
this.Content_1.VerticalOptions = LayoutOptions.Center;
|
||||
this.btnGenerate.VerticalOptions = LayoutOptions.Center;
|
||||
this.btnGenerate.BackgroundColor = Color.Gray;
|
||||
}
|
||||
else if (Device.Idiom == TargetIdiom.Phone && Device.RuntimePlatform == Device.UWP)
|
||||
{
|
||||
// if (!SampleBrowser.DocIO.App.isUWP)
|
||||
// {
|
||||
// this.Content_1.FontSize = 18.5;
|
||||
//}
|
||||
//else
|
||||
// {
|
||||
this.Content_1.FontSize = 13.5;
|
||||
// }
|
||||
|
||||
this.Content_1.VerticalOptions = LayoutOptions.Center;
|
||||
this.btnGenerate.VerticalOptions = LayoutOptions.Center;
|
||||
}
|
||||
}
|
||||
void OnButtonClicked(object sender, EventArgs e)
|
||||
{
|
||||
Assembly assembly = typeof(MailMerge).GetTypeInfo().Assembly;
|
||||
#if COMMONSB
|
||||
string rootPath = "SampleBrowser.Samples.DocIO.Samples.Templates.";
|
||||
#else
|
||||
string rootPath = "SampleBrowser.DocIO.Samples.Templates.";
|
||||
#endif
|
||||
// Creating a new document.
|
||||
WordDocument document = new WordDocument();
|
||||
Stream inputStream = assembly.GetManifestResourceStream(rootPath + "Letter Formatting.docx");
|
||||
//Open Template document
|
||||
document.Open(inputStream, FormatType.Word2013);
|
||||
inputStream.Dispose();
|
||||
List<Customer> source = new List<Customer>();
|
||||
source.Add(new Customer("ALFKI", "Alfreds Futterkiste", "Maria Anders", "Sales Representative", "Obere Str. 57", "Berlin", "12209", "Germany", "030-0074321", "030-0076545"));
|
||||
//source.Add(new Customer("ANATR", "Ana Trujillo Emparedados y helados", "Ana Trujillo", "Owner", "Avda. de la Constitución 2222", "México D.F.", "05021", "Mexico", "(5) 555-4729", "(5) 555-3745"));
|
||||
document.MailMerge.Execute(source);
|
||||
|
||||
MemoryStream stream = new MemoryStream();
|
||||
document.Save(stream, FormatType.Word2013);
|
||||
document.Close();
|
||||
|
||||
if (Device.RuntimePlatform == Device.UWP)
|
||||
Xamarin.Forms.DependencyService.Get<ISaveWindowsPhone>().Save("LetterFormatting.docx", "application/msword", stream);
|
||||
else
|
||||
Xamarin.Forms.DependencyService.Get<ISave>().Save("LetterFormatting.docx", "application/msword", stream);
|
||||
}
|
||||
}
|
||||
public class Customer
|
||||
{
|
||||
#region fields
|
||||
string m_customerID;
|
||||
string m_companyName;
|
||||
string m_contactName;
|
||||
string m_contactTitle;
|
||||
string m_address;
|
||||
string m_city;
|
||||
string m_postalCode;
|
||||
string m_country;
|
||||
string m_phone;
|
||||
string m_fax;
|
||||
#endregion
|
||||
|
||||
#region properties
|
||||
public string CustomerID
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_customerID;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_customerID = value;
|
||||
}
|
||||
}
|
||||
public string CompanyName
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_companyName;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_companyName = value;
|
||||
}
|
||||
}
|
||||
public string ContactName
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_contactName;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_contactName = value;
|
||||
}
|
||||
}
|
||||
public string ContactTitle
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_contactTitle;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_contactTitle = value;
|
||||
}
|
||||
}
|
||||
public string Address
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_address;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_address = value;
|
||||
}
|
||||
}
|
||||
public string City
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_city;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_city = value;
|
||||
}
|
||||
}
|
||||
public string PostalCode
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_postalCode;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_postalCode = value;
|
||||
}
|
||||
}
|
||||
public string Country
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_country;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_country = value;
|
||||
}
|
||||
}
|
||||
public string Phone
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_phone;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_phone = value;
|
||||
}
|
||||
}
|
||||
public string Fax
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_fax;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_fax = value;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region constructor
|
||||
public Customer()
|
||||
{ }
|
||||
|
||||
public Customer(string customerID, string companyName, string contactName, string contactTitle, string address, string city, string postalCode, string country, string phone, string fax)
|
||||
{
|
||||
m_customerID = customerID;
|
||||
m_companyName = companyName;
|
||||
m_contactName = contactName;
|
||||
m_contactTitle = contactTitle;
|
||||
m_address = address;
|
||||
m_city = city;
|
||||
m_postalCode = postalCode;
|
||||
m_country = country;
|
||||
m_phone = phone;
|
||||
m_fax = fax;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
После Ширина: | Высота: | Размер: 79 KiB |
|
@ -0,0 +1,258 @@
|
|||
<?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>
|
После Ширина: | Высота: | Размер: 20 KiB |
После Ширина: | Высота: | Размер: 18 KiB |
После Ширина: | Высота: | Размер: 87 KiB |
|
@ -0,0 +1,54 @@
|
|||
<?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>
|
||||
|
После Ширина: | Высота: | Размер: 20 KiB |
|
@ -0,0 +1,24 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<local:SampleView
|
||||
xmlns:local="clr-namespace:SampleBrowser.Core;assembly=SampleBrowser.Core"
|
||||
xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="SampleBrowser.DocIO.WordToHTML">
|
||||
|
||||
<local:SampleView.Content>
|
||||
<StackLayout Padding ="10">
|
||||
|
||||
<Label x:Name="Content_1" Text="This sample illustrates how to convert a Word document into HTML file."
|
||||
FontSize="Medium" VerticalOptions="Center">
|
||||
</Label>
|
||||
|
||||
<Label></Label>
|
||||
|
||||
<Button x:Name="btnGenerate" Clicked ="OnButtonClicked" Text ="Generate HTML" HorizontalOptions="Center" VerticalOptions="Center"></Button>
|
||||
</StackLayout>
|
||||
</local:SampleView.Content>
|
||||
<local:SampleView.PropertyView>
|
||||
|
||||
</local:SampleView.PropertyView>
|
||||
|
||||
</local:SampleView>
|
|
@ -0,0 +1,98 @@
|
|||
#region Copyright Syncfusion Inc. 2001-2019.
|
||||
// Copyright Syncfusion Inc. 2001-2019. 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.DocIO;
|
||||
using SampleBrowser.Core;
|
||||
using Syncfusion.DocIO.DLS;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Xamarin.Forms;
|
||||
using SampleBrowser.DocIO;
|
||||
|
||||
namespace SampleBrowser.DocIO
|
||||
{
|
||||
public partial class WordToHTML : SampleView
|
||||
{
|
||||
public WordToHTML()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
if (Device.Idiom != TargetIdiom.Phone && Device.RuntimePlatform == Device.UWP)
|
||||
{
|
||||
|
||||
this.Content_1.HorizontalOptions = LayoutOptions.Start;
|
||||
this.btnGenerate.HorizontalOptions = LayoutOptions.Start;
|
||||
|
||||
|
||||
this.Content_1.VerticalOptions = LayoutOptions.Center;
|
||||
this.btnGenerate.VerticalOptions = LayoutOptions.Center;
|
||||
this.btnGenerate.BackgroundColor = Xamarin.Forms.Color.Gray;
|
||||
}
|
||||
else if (Device.Idiom == TargetIdiom.Phone && Device.RuntimePlatform == Device.UWP)
|
||||
{
|
||||
// if (!SampleBrowser.DocIO.App.isUWP)
|
||||
// {
|
||||
// this.Content_1.FontSize = 18.5;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
this.Content_1.FontSize = 13.5;
|
||||
// }
|
||||
|
||||
this.Content_1.VerticalOptions = LayoutOptions.Center;
|
||||
this.btnGenerate.VerticalOptions = LayoutOptions.Center;
|
||||
}
|
||||
}
|
||||
void OnButtonClicked(object sender, EventArgs e)
|
||||
{
|
||||
Assembly assembly = typeof(WordToHTML).GetTypeInfo().Assembly;
|
||||
// Creating a new document.
|
||||
WordDocument document = new WordDocument();
|
||||
#if COMMONSB
|
||||
string rootPath = "SampleBrowser.Samples.DocIO.Samples.Templates.";
|
||||
#else
|
||||
string rootPath = "SampleBrowser.DocIO.Samples.Templates.";
|
||||
#endif
|
||||
Stream inputStream = assembly.GetManifestResourceStream(rootPath + "WordtoHTML.doc");
|
||||
//Open the Word document to convert
|
||||
document.Open(inputStream, FormatType.Doc);
|
||||
//Export the Word document to HTML file
|
||||
MemoryStream stream = new MemoryStream();
|
||||
HTMLExport htmlExport = new HTMLExport();
|
||||
htmlExport.SaveAsXhtml(document, stream);
|
||||
document.Close();
|
||||
|
||||
if (Device.RuntimePlatform == Device.UWP)
|
||||
Xamarin.Forms.DependencyService.Get<ISaveWindowsPhone>().Save("WordtoHTML.html", "application/html", stream);
|
||||
else
|
||||
Xamarin.Forms.DependencyService.Get<ISave>().Save("WordtoHTML.html", "application/html", stream);
|
||||
if (!(Device.Idiom != TargetIdiom.Phone && Device.RuntimePlatform == Device.UWP))
|
||||
{
|
||||
//Set the stream to start position to read the content as string
|
||||
stream.Position = 0;
|
||||
StreamReader reader = new StreamReader(stream);
|
||||
string htmlString = reader.ReadToEnd();
|
||||
|
||||
//Set the HtmlWebViewSource to the html string
|
||||
HtmlWebViewSource html = new HtmlWebViewSource();
|
||||
html.Html = htmlString;
|
||||
|
||||
//Create the web view control to view the web page
|
||||
WebView view = new WebView();
|
||||
view.Source = html;
|
||||
ContentPage webpage = new ContentPage();
|
||||
webpage.Content = view;
|
||||
this.Content.Navigation.PushAsync(webpage);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<local:SampleView
|
||||
xmlns:local="clr-namespace:SampleBrowser.Core;assembly=SampleBrowser.Core"
|
||||
xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="SampleBrowser.DocIO.XMLMapping">
|
||||
|
||||
<local:SampleView.Content>
|
||||
<StackLayout Padding ="10">
|
||||
|
||||
|
||||
<Label x:Name="Content_1" Text="This sample illustrates how to map custom XML part to content controls in the Word document."
|
||||
FontSize="Medium" VerticalOptions="Center">
|
||||
</Label>
|
||||
|
||||
<Label></Label>
|
||||
|
||||
<Button x:Name="btnGenerate" Clicked ="OnButtonClicked" Text ="Generate Word" HorizontalOptions="Center" VerticalOptions="Center"></Button>
|
||||
</StackLayout>
|
||||
</local:SampleView.Content>
|
||||
<local:SampleView.PropertyView>
|
||||
|
||||
</local:SampleView.PropertyView>
|
||||
|
||||
</local:SampleView>
|
|
@ -0,0 +1,275 @@
|
|||
#region Copyright Syncfusion Inc. 2001-2017.
|
||||
// Copyright Syncfusion Inc. 2001-2017. 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 SampleBrowser.Core;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using Syncfusion.DocIO;
|
||||
using Syncfusion.DocIO.DLS;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace SampleBrowser.DocIO
|
||||
{
|
||||
/// <summary>
|
||||
/// A sample view that can be used on XMLMapping.
|
||||
/// </summary>
|
||||
public partial class XMLMapping : SampleView
|
||||
{
|
||||
/// <summary>
|
||||
/// Constructor for XMLMapping.
|
||||
/// </summary>
|
||||
public XMLMapping()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
if (Device.Idiom != TargetIdiom.Phone && Device.RuntimePlatform == Device.UWP)
|
||||
{
|
||||
|
||||
this.Content_1.HorizontalOptions = LayoutOptions.Start;
|
||||
this.btnGenerate.HorizontalOptions = LayoutOptions.Start;
|
||||
|
||||
|
||||
this.Content_1.VerticalOptions = LayoutOptions.Center;
|
||||
this.btnGenerate.VerticalOptions = LayoutOptions.Center;
|
||||
this.btnGenerate.BackgroundColor = Xamarin.Forms.Color.Gray;
|
||||
}
|
||||
else if (Device.Idiom == TargetIdiom.Phone && Device.RuntimePlatform == Device.UWP)
|
||||
{
|
||||
//if (!SampleBrowser.DocIO.App.isUWP)
|
||||
//{
|
||||
// this.Content_1.FontSize = 18.5;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
this.Content_1.FontSize = 13.5;
|
||||
// }
|
||||
|
||||
this.Content_1.VerticalOptions = LayoutOptions.Center;
|
||||
this.btnGenerate.VerticalOptions = LayoutOptions.Center;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Button click event for XMLMapping.
|
||||
/// </summary>
|
||||
/// <param name="sender">Sender</param>
|
||||
/// <param name="e">Event args</param>
|
||||
private void OnButtonClicked(object sender, EventArgs e)
|
||||
{
|
||||
#if COMMONSB
|
||||
string rootPath = "SampleBrowser.Samples.DocIO.Samples.Templates.";
|
||||
#else
|
||||
string rootPath = "SampleBrowser.DocIO.Samples.Templates.";
|
||||
#endif
|
||||
// Load Template document stream.
|
||||
Stream inputStream = typeof(XMLMapping).GetTypeInfo().Assembly.GetManifestResourceStream(rootPath + "Employees.xml");
|
||||
|
||||
// Create a new document.
|
||||
WordDocument document = new WordDocument();
|
||||
|
||||
//Add a section & a paragraph in the empty document.
|
||||
document.EnsureMinimal();
|
||||
|
||||
//Loads XML file into the customXML part of the Word document.
|
||||
CustomXMLPart docIOxmlPart = new CustomXMLPart(document);
|
||||
docIOxmlPart.Load(inputStream);
|
||||
|
||||
//Insert content controls and maps Employees details to it.
|
||||
InsertAndMapEmployees(document, "EmployeesList", docIOxmlPart);
|
||||
|
||||
MemoryStream stream = new MemoryStream();
|
||||
document.Save(stream, FormatType.Docx);
|
||||
document.Close();
|
||||
|
||||
if (Device.RuntimePlatform == Device.UWP)
|
||||
DependencyService.Get<ISaveWindowsPhone>()
|
||||
.Save("XMLMapping.docx", "application/msword", stream);
|
||||
else
|
||||
DependencyService.Get<ISave>().Save("XMLMapping.docx", "application/msword", stream);
|
||||
}
|
||||
/// <summary>
|
||||
/// Insert and Maps CustomXMLPart to content control based on XPath.
|
||||
/// </summary>
|
||||
/// <param name="paragraph">Paragraph instance to append content control.</param>
|
||||
/// <param name="XPath">XPath of the CustomXMLNode to be mapped</param>
|
||||
/// <param name="custXMLPart">CustomXMLPart of the CustomXMLNode</param>
|
||||
private void MapCustomXMLPart(IWParagraph paragraph, string XPath, CustomXMLPart custXMLPart)
|
||||
{
|
||||
IInlineContentControl contentControl = paragraph.AppendInlineContentControl(ContentControlType.Text);
|
||||
contentControl.ContentControlProperties.XmlMapping.SetMapping(XPath, string.Empty, custXMLPart);
|
||||
}
|
||||
/// <summary>
|
||||
/// Inserts content control and maps the employees details to it.
|
||||
/// </summary>
|
||||
/// <param name="document">Word document instance.</param>
|
||||
/// <param name="xmlRootPath">Custom XML root Xpath.</param>
|
||||
/// <param name="docIOxmlPart">CustomXMLPart instance.</param>
|
||||
private void InsertAndMapEmployees(WordDocument document, string xmlRootPath, CustomXMLPart docIOxmlPart)
|
||||
{
|
||||
//Retrieving CustomXMLNode from xmlRootPath.
|
||||
CustomXMLNode parentNode = docIOxmlPart.SelectSingleNode(xmlRootPath);
|
||||
|
||||
int empIndex = 1;
|
||||
foreach (CustomXMLNode employeeNode in parentNode.ChildNodes)
|
||||
{
|
||||
if (employeeNode.HasChildNodes())
|
||||
{
|
||||
//Adds new paragraph to the section
|
||||
IWParagraph paragraph = document.LastSection.AddParagraph();
|
||||
paragraph.ParagraphFormat.BackColor = Syncfusion.Drawing.Color.Gray;
|
||||
|
||||
IWTextRange textrange = paragraph.AppendText("Employee");
|
||||
textrange.CharacterFormat.TextColor = Syncfusion.Drawing.Color.White;
|
||||
textrange.CharacterFormat.Bold = true;
|
||||
textrange.CharacterFormat.FontSize = 14;
|
||||
|
||||
//Insert content controls and maps Employee details to it.
|
||||
InsertAndMapEmployee(document, employeeNode, xmlRootPath, docIOxmlPart, empIndex);
|
||||
}
|
||||
empIndex++;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Inserts content control and maps the employee details to it.
|
||||
/// </summary>
|
||||
/// <param name="document">Word document instance.</param>
|
||||
/// <param name="employeesNode">CustomXMLNode of employee.</param>
|
||||
/// <param name="rootXmlPath">Custom XML root Xpath.</param>
|
||||
/// <param name="docIOxmlPart">CustomXMLPart instance.</param>
|
||||
/// <param name="empIndex">Current employee index.</param>
|
||||
private void InsertAndMapEmployee(WordDocument document, CustomXMLNode employeesNode, string rootXmlPath, CustomXMLPart docIOxmlPart, int empIndex)
|
||||
{
|
||||
//Column names of Employee element.
|
||||
string[] employeesDetails = { "FirstName", "LastName", "Employee ID", "Extension", "Address", "City", "Country" };
|
||||
int empChildIndex = 0;
|
||||
int customerIndex = 1;
|
||||
|
||||
// Append current empolyee XPath with root XPath.
|
||||
string empPath = "/" + rootXmlPath + "/Employees[" + empIndex + "]/";
|
||||
// Iterating child elements of Employee
|
||||
foreach (CustomXMLNode employeeChild in employeesNode.ChildNodes)
|
||||
{
|
||||
IWParagraph paragraph = document.LastParagraph;
|
||||
if (employeeChild.HasChildNodes())
|
||||
{
|
||||
//Insert a content controls and maps Customer details to it.
|
||||
InsertAndMapCustomer(document, employeeChild, docIOxmlPart, empPath, customerIndex);
|
||||
customerIndex++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (empChildIndex != 1)
|
||||
{
|
||||
//Insert a content controls and maps Employee details other than Customer details to it.
|
||||
paragraph = document.LastSection.AddParagraph();
|
||||
if (empChildIndex == 0)
|
||||
paragraph.AppendText("Name: ");
|
||||
else
|
||||
paragraph.AppendText(employeesDetails[empChildIndex] + ": ");
|
||||
}
|
||||
else
|
||||
paragraph.AppendText(" ");
|
||||
MapCustomXMLPart(paragraph, empPath + employeesDetails[empChildIndex].Replace(" ",""), docIOxmlPart);
|
||||
}
|
||||
empChildIndex++;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Insert a content controls and maps Customer details to it.
|
||||
/// </summary>
|
||||
/// <param name="document">Word document instance.</param>
|
||||
/// <param name="customerNode">CustomXMLNode of customer.</param>
|
||||
/// <param name="docIOxmlPart">CustomXMLPart instance.</param>
|
||||
/// <param name="empPath">Current employee index.</param>
|
||||
/// <param name="custIndex">Current customer index.</param>
|
||||
private void InsertAndMapCustomer(WordDocument document, CustomXMLNode customerNode, CustomXMLPart docIOxmlPart, string empPath, int custIndex)
|
||||
{
|
||||
//Column names of Customer element.
|
||||
string[] customersDetails = { "Customer ID", "Employee ID", "Company Name", "Contact Name", "City", "Country" };
|
||||
|
||||
document.LastSection.AddParagraph();
|
||||
|
||||
//Adds new paragraph to the section
|
||||
IWParagraph paragraph = document.LastSection.AddParagraph();
|
||||
paragraph.ParagraphFormat.BackColor = Syncfusion.Drawing.Color.Green;
|
||||
paragraph.ParagraphFormat.LeftIndent = 72;
|
||||
|
||||
IWTextRange textrange = paragraph.AppendText("Customers");
|
||||
textrange.CharacterFormat.TextColor = Syncfusion.Drawing.Color.White;
|
||||
textrange.CharacterFormat.Bold = true;
|
||||
textrange.CharacterFormat.FontSize = 14;
|
||||
|
||||
int orderIndex = 1;
|
||||
int custChild = 0;
|
||||
bool isFirstOrder = true;
|
||||
string customerXpath = empPath + "Customers[" + custIndex + "]/";
|
||||
foreach (CustomXMLNode customerChild in customerNode.ChildNodes)
|
||||
{
|
||||
if (customerChild.HasChildNodes())
|
||||
{
|
||||
//Insert a content controls and maps Orders details to it.
|
||||
InsertAndMapOrders(document, customerChild, docIOxmlPart, customerXpath, orderIndex, isFirstOrder);
|
||||
document.LastSection.AddParagraph();
|
||||
isFirstOrder = false;
|
||||
orderIndex++;
|
||||
}
|
||||
else
|
||||
{
|
||||
//Insert a content controls and maps Customer details other than Order details to it.
|
||||
paragraph = document.LastSection.AddParagraph();
|
||||
paragraph.ParagraphFormat.LeftIndent = 72;
|
||||
|
||||
paragraph.AppendText(customersDetails[custChild] + ": ");
|
||||
MapCustomXMLPart(paragraph, customerXpath + customersDetails[custChild].Replace(" ", ""), docIOxmlPart);
|
||||
}
|
||||
custChild++;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Insert a content controls and maps Orders details to it.
|
||||
/// </summary>
|
||||
/// <param name="document">Word document instance.</param>
|
||||
/// <param name="orderNode">CustomXMLNode of order.</param>
|
||||
/// <param name="docIOxmlPart">CustomXMLPart instance.</param>
|
||||
/// <param name="custPath">Current customer index</param>
|
||||
/// <param name="orderIndex">Current order index</param>
|
||||
/// <param name="isFirst">Indicates whether it is the first order of the customer.</param>
|
||||
private void InsertAndMapOrders(WordDocument document, CustomXMLNode orderNode, CustomXMLPart docIOxmlPart, string custPath, int orderIndex, bool isFirst)
|
||||
{
|
||||
//Column names of order element.
|
||||
string[] ordersDetails = { "Order ID", "Customer ID", "Order Date", "Shipped Date", "Required Date" };
|
||||
|
||||
IWParagraph paragraph = null;
|
||||
IWTextRange textrange = null;
|
||||
if (isFirst)
|
||||
{
|
||||
document.LastSection.AddParagraph();
|
||||
//Adds new paragraph to the section
|
||||
paragraph = document.LastSection.AddParagraph();
|
||||
paragraph.ParagraphFormat.BackColor = Syncfusion.Drawing.Color.Red;
|
||||
paragraph.ParagraphFormat.LeftIndent = 128;
|
||||
|
||||
textrange = paragraph.AppendText("Orders");
|
||||
textrange.CharacterFormat.TextColor = Syncfusion.Drawing.Color.White;
|
||||
textrange.CharacterFormat.Bold = true;
|
||||
textrange.CharacterFormat.FontSize = 14;
|
||||
}
|
||||
int orderChildIndex = 0;
|
||||
string customerXpath = custPath + "Orders[" + orderIndex + "]/";
|
||||
foreach (CustomXMLNode orderChild in orderNode.ChildNodes)
|
||||
{
|
||||
//Adds new paragraph to the section
|
||||
paragraph = document.LastSection.AddParagraph();
|
||||
paragraph.ParagraphFormat.LeftIndent = 128;
|
||||
|
||||
paragraph.AppendText(ordersDetails[orderChildIndex] + ": ");
|
||||
MapCustomXMLPart(paragraph, customerXpath + "/" + ordersDetails[orderChildIndex].Replace(" ", ""), docIOxmlPart);
|
||||
orderChildIndex++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<Samples>
|
||||
<Sample EnableStoragePermission="true" Name="GettingStartedDocIO" Title="Getting Started" Type="SampleBrowser.DocIO.GettingStartedDocIO" Description="This sample demonstrates how to create simple Word document with text, images and tables." SearchTags="create, word, document" />
|
||||
<Sample EnableStoragePermission="true" Name="BuiltInStyle" Title="Built-in Style" Type="SampleBrowser.DocIO.BuiltInStyle" Description="This sample demonstrates how to format the Word document contents with the built-in styles." SearchTags="formatting, style, appearance, built-in" />
|
||||
<Sample EnableStoragePermission="true" Name="CustomStyle" Title="Custom Style" Type="SampleBrowser.DocIO.CustomStyle" Description="This sample demonstrates how to format the Word document contents with user defined styles." SearchTags="formatting, style, appearance, custom" />
|
||||
<Sample EnableStoragePermission="true" Name="BookmarkNavigation" Title="Bookmark Navigation" Type="SampleBrowser.DocIO.BookmarkNavigation" Description="This sample demonstrates how to insert, retrieve, replace and delete the contents of a specified bookmark using BookmarkNavigator functionality of DocIO." SearchTags="bookmark, hyperlink, reference" />
|
||||
<Sample EnableStoragePermission="true" Name="DocIO_PieChart" Title= "Pie Chart" Type = "SampleBrowser.DocIO.DocIO_PieChart" Description="This sample demonstrates how to create a pie chart in a Word document." SearchTags="chart, legend, axis, pie" />
|
||||
<Sample EnableStoragePermission="true" Name="DocIO_BarChart" Title ="Bar Chart" Type="SampleBrowser.DocIO_BarChart" Description="This sample demonstrates how to create a bar chart in a Word document with the data from an existing Excel file." SearchTags="chart, legend, axis, bar" />
|
||||
<Sample EnableStoragePermission="true" Name="MailMerge" Title="Mail Merge" Type="SampleBrowser.MailMerge" Description="This sample demonstrates how to create a letter format document by filling the data using Mail merge functionality of DocIO." SearchTags="mail, merge, template" />
|
||||
<Sample EnableStoragePermission="true" Name="FormFillingAndProtection" Title="Form Filling and Protection" Type="SampleBrowser.FormFillingAndProtection" Description="This sample demonstrates how to fill data and protect the content controls in an existing Word document." SearchTags="content, control, protection, form" />
|
||||
<Sample EnableStoragePermission="true" Name="XMLMapping" Title="XML Mapping" Type="SampleBrowser.XMLMapping" Description="This sample demonstrates how to map custom XML part to content controls in the Word document." SearchTags="content, control, xml, mapping" />
|
||||
<Sample EnableStoragePermission="true" Name="WordToHTML" Title="Word to HTML" Type="SampleBrowser.WordToHTML" Description="This sample demonstrates how to convert a Word document into HTML file." SearchTags="html, export, convert, xhtml" />
|
||||
</Samples>
|
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<packageRestore>
|
||||
<add key="enabled" value="True"/>
|
||||
<add key="automatic" value="True"/>
|
||||
</packageRestore>
|
||||
<packageSources>
|
||||
<add key="Syncfusion Xamarin Source Package 17.1.0.38" value="https://api.nuget.org/v3/index.json"/></packageSources>
|
||||
<activePackageSource>
|
||||
</activePackageSource>
|
||||
<bindingRedirects>
|
||||
<add key="skip" value="False"/>
|
||||
</bindingRedirects>
|
||||
</configuration>
|
|
@ -0,0 +1,267 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.27130.2003
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SampleBrowser.DocIO.Droid", "DocIO.Droid\SampleBrowser.DocIO.Droid.csproj", "{DEC3BC88-6A26-4282-BF1B-0D5989F58CB1}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SampleBrowser.DocIO.iOS", "DocIO.iOS\SampleBrowser.DocIO.iOS.csproj", "{F4D99EF7-F197-428F-92DE-7482DBAD7476}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SampleBrowser.DocIO.UWP", "DocIO.UWP\SampleBrowser.DocIO.UWP.csproj", "{C6469FB2-9CF4-453E-9ADF-0ACBC386A113}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SampleBrowser.DocIO", "DocIO\SampleBrowser.DocIO.csproj", "{E1ED970F-0056-4353-B648-D5AC2B9633C2}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Ad-Hoc|Any CPU = Ad-Hoc|Any CPU
|
||||
Ad-Hoc|ARM = Ad-Hoc|ARM
|
||||
Ad-Hoc|iPhone = Ad-Hoc|iPhone
|
||||
Ad-Hoc|iPhoneSimulator = Ad-Hoc|iPhoneSimulator
|
||||
Ad-Hoc|x64 = Ad-Hoc|x64
|
||||
Ad-Hoc|x86 = Ad-Hoc|x86
|
||||
AppStore|Any CPU = AppStore|Any CPU
|
||||
AppStore|ARM = AppStore|ARM
|
||||
AppStore|iPhone = AppStore|iPhone
|
||||
AppStore|iPhoneSimulator = AppStore|iPhoneSimulator
|
||||
AppStore|x64 = AppStore|x64
|
||||
AppStore|x86 = AppStore|x86
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Debug|ARM = Debug|ARM
|
||||
Debug|iPhone = Debug|iPhone
|
||||
Debug|iPhoneSimulator = Debug|iPhoneSimulator
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Release|Any CPU = Release|Any CPU
|
||||
Release|ARM = Release|ARM
|
||||
Release|iPhone = Release|iPhone
|
||||
Release|iPhoneSimulator = Release|iPhoneSimulator
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{DEC3BC88-6A26-4282-BF1B-0D5989F58CB1}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{DEC3BC88-6A26-4282-BF1B-0D5989F58CB1}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU
|
||||
{DEC3BC88-6A26-4282-BF1B-0D5989F58CB1}.Ad-Hoc|Any CPU.Deploy.0 = Release|Any CPU
|
||||
{DEC3BC88-6A26-4282-BF1B-0D5989F58CB1}.Ad-Hoc|ARM.ActiveCfg = Release|Any CPU
|
||||
{DEC3BC88-6A26-4282-BF1B-0D5989F58CB1}.Ad-Hoc|ARM.Build.0 = Release|Any CPU
|
||||
{DEC3BC88-6A26-4282-BF1B-0D5989F58CB1}.Ad-Hoc|ARM.Deploy.0 = Release|Any CPU
|
||||
{DEC3BC88-6A26-4282-BF1B-0D5989F58CB1}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU
|
||||
{DEC3BC88-6A26-4282-BF1B-0D5989F58CB1}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU
|
||||
{DEC3BC88-6A26-4282-BF1B-0D5989F58CB1}.Ad-Hoc|iPhone.Deploy.0 = Release|Any CPU
|
||||
{DEC3BC88-6A26-4282-BF1B-0D5989F58CB1}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU
|
||||
{DEC3BC88-6A26-4282-BF1B-0D5989F58CB1}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU
|
||||
{DEC3BC88-6A26-4282-BF1B-0D5989F58CB1}.Ad-Hoc|iPhoneSimulator.Deploy.0 = Release|Any CPU
|
||||
{DEC3BC88-6A26-4282-BF1B-0D5989F58CB1}.Ad-Hoc|x64.ActiveCfg = Release|Any CPU
|
||||
{DEC3BC88-6A26-4282-BF1B-0D5989F58CB1}.Ad-Hoc|x64.Build.0 = Release|Any CPU
|
||||
{DEC3BC88-6A26-4282-BF1B-0D5989F58CB1}.Ad-Hoc|x64.Deploy.0 = Release|Any CPU
|
||||
{DEC3BC88-6A26-4282-BF1B-0D5989F58CB1}.Ad-Hoc|x86.ActiveCfg = Release|Any CPU
|
||||
{DEC3BC88-6A26-4282-BF1B-0D5989F58CB1}.Ad-Hoc|x86.Build.0 = Release|Any CPU
|
||||
{DEC3BC88-6A26-4282-BF1B-0D5989F58CB1}.Ad-Hoc|x86.Deploy.0 = Release|Any CPU
|
||||
{DEC3BC88-6A26-4282-BF1B-0D5989F58CB1}.AppStore|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{DEC3BC88-6A26-4282-BF1B-0D5989F58CB1}.AppStore|Any CPU.Build.0 = Release|Any CPU
|
||||
{DEC3BC88-6A26-4282-BF1B-0D5989F58CB1}.AppStore|Any CPU.Deploy.0 = Release|Any CPU
|
||||
{DEC3BC88-6A26-4282-BF1B-0D5989F58CB1}.AppStore|ARM.ActiveCfg = Release|Any CPU
|
||||
{DEC3BC88-6A26-4282-BF1B-0D5989F58CB1}.AppStore|ARM.Build.0 = Release|Any CPU
|
||||
{DEC3BC88-6A26-4282-BF1B-0D5989F58CB1}.AppStore|ARM.Deploy.0 = Release|Any CPU
|
||||
{DEC3BC88-6A26-4282-BF1B-0D5989F58CB1}.AppStore|iPhone.ActiveCfg = Release|Any CPU
|
||||
{DEC3BC88-6A26-4282-BF1B-0D5989F58CB1}.AppStore|iPhone.Build.0 = Release|Any CPU
|
||||
{DEC3BC88-6A26-4282-BF1B-0D5989F58CB1}.AppStore|iPhone.Deploy.0 = Release|Any CPU
|
||||
{DEC3BC88-6A26-4282-BF1B-0D5989F58CB1}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU
|
||||
{DEC3BC88-6A26-4282-BF1B-0D5989F58CB1}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU
|
||||
{DEC3BC88-6A26-4282-BF1B-0D5989F58CB1}.AppStore|iPhoneSimulator.Deploy.0 = Release|Any CPU
|
||||
{DEC3BC88-6A26-4282-BF1B-0D5989F58CB1}.AppStore|x64.ActiveCfg = Release|Any CPU
|
||||
{DEC3BC88-6A26-4282-BF1B-0D5989F58CB1}.AppStore|x64.Build.0 = Release|Any CPU
|
||||
{DEC3BC88-6A26-4282-BF1B-0D5989F58CB1}.AppStore|x64.Deploy.0 = Release|Any CPU
|
||||
{DEC3BC88-6A26-4282-BF1B-0D5989F58CB1}.AppStore|x86.ActiveCfg = Release|Any CPU
|
||||
{DEC3BC88-6A26-4282-BF1B-0D5989F58CB1}.AppStore|x86.Build.0 = Release|Any CPU
|
||||
{DEC3BC88-6A26-4282-BF1B-0D5989F58CB1}.AppStore|x86.Deploy.0 = Release|Any CPU
|
||||
{DEC3BC88-6A26-4282-BF1B-0D5989F58CB1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{DEC3BC88-6A26-4282-BF1B-0D5989F58CB1}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{DEC3BC88-6A26-4282-BF1B-0D5989F58CB1}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
|
||||
{DEC3BC88-6A26-4282-BF1B-0D5989F58CB1}.Debug|ARM.ActiveCfg = Debug|Any CPU
|
||||
{DEC3BC88-6A26-4282-BF1B-0D5989F58CB1}.Debug|ARM.Build.0 = Debug|Any CPU
|
||||
{DEC3BC88-6A26-4282-BF1B-0D5989F58CB1}.Debug|ARM.Deploy.0 = Debug|Any CPU
|
||||
{DEC3BC88-6A26-4282-BF1B-0D5989F58CB1}.Debug|iPhone.ActiveCfg = Debug|Any CPU
|
||||
{DEC3BC88-6A26-4282-BF1B-0D5989F58CB1}.Debug|iPhone.Build.0 = Debug|Any CPU
|
||||
{DEC3BC88-6A26-4282-BF1B-0D5989F58CB1}.Debug|iPhone.Deploy.0 = Debug|Any CPU
|
||||
{DEC3BC88-6A26-4282-BF1B-0D5989F58CB1}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
|
||||
{DEC3BC88-6A26-4282-BF1B-0D5989F58CB1}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
|
||||
{DEC3BC88-6A26-4282-BF1B-0D5989F58CB1}.Debug|iPhoneSimulator.Deploy.0 = Debug|Any CPU
|
||||
{DEC3BC88-6A26-4282-BF1B-0D5989F58CB1}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{DEC3BC88-6A26-4282-BF1B-0D5989F58CB1}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{DEC3BC88-6A26-4282-BF1B-0D5989F58CB1}.Debug|x64.Deploy.0 = Debug|Any CPU
|
||||
{DEC3BC88-6A26-4282-BF1B-0D5989F58CB1}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{DEC3BC88-6A26-4282-BF1B-0D5989F58CB1}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{DEC3BC88-6A26-4282-BF1B-0D5989F58CB1}.Debug|x86.Deploy.0 = Debug|Any CPU
|
||||
{DEC3BC88-6A26-4282-BF1B-0D5989F58CB1}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{DEC3BC88-6A26-4282-BF1B-0D5989F58CB1}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{DEC3BC88-6A26-4282-BF1B-0D5989F58CB1}.Release|Any CPU.Deploy.0 = Release|Any CPU
|
||||
{DEC3BC88-6A26-4282-BF1B-0D5989F58CB1}.Release|ARM.ActiveCfg = Release|Any CPU
|
||||
{DEC3BC88-6A26-4282-BF1B-0D5989F58CB1}.Release|ARM.Build.0 = Release|Any CPU
|
||||
{DEC3BC88-6A26-4282-BF1B-0D5989F58CB1}.Release|ARM.Deploy.0 = Release|Any CPU
|
||||
{DEC3BC88-6A26-4282-BF1B-0D5989F58CB1}.Release|iPhone.ActiveCfg = Release|Any CPU
|
||||
{DEC3BC88-6A26-4282-BF1B-0D5989F58CB1}.Release|iPhone.Build.0 = Release|Any CPU
|
||||
{DEC3BC88-6A26-4282-BF1B-0D5989F58CB1}.Release|iPhone.Deploy.0 = Release|Any CPU
|
||||
{DEC3BC88-6A26-4282-BF1B-0D5989F58CB1}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
|
||||
{DEC3BC88-6A26-4282-BF1B-0D5989F58CB1}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
|
||||
{DEC3BC88-6A26-4282-BF1B-0D5989F58CB1}.Release|iPhoneSimulator.Deploy.0 = Release|Any CPU
|
||||
{DEC3BC88-6A26-4282-BF1B-0D5989F58CB1}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{DEC3BC88-6A26-4282-BF1B-0D5989F58CB1}.Release|x64.Build.0 = Release|Any CPU
|
||||
{DEC3BC88-6A26-4282-BF1B-0D5989F58CB1}.Release|x64.Deploy.0 = Release|Any CPU
|
||||
{DEC3BC88-6A26-4282-BF1B-0D5989F58CB1}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{DEC3BC88-6A26-4282-BF1B-0D5989F58CB1}.Release|x86.Build.0 = Release|Any CPU
|
||||
{DEC3BC88-6A26-4282-BF1B-0D5989F58CB1}.Release|x86.Deploy.0 = Release|Any CPU
|
||||
{F4D99EF7-F197-428F-92DE-7482DBAD7476}.Ad-Hoc|Any CPU.ActiveCfg = Ad-Hoc|iPhone
|
||||
{F4D99EF7-F197-428F-92DE-7482DBAD7476}.Ad-Hoc|ARM.ActiveCfg = Ad-Hoc|iPhone
|
||||
{F4D99EF7-F197-428F-92DE-7482DBAD7476}.Ad-Hoc|iPhone.ActiveCfg = Ad-Hoc|iPhone
|
||||
{F4D99EF7-F197-428F-92DE-7482DBAD7476}.Ad-Hoc|iPhone.Build.0 = Ad-Hoc|iPhone
|
||||
{F4D99EF7-F197-428F-92DE-7482DBAD7476}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Ad-Hoc|iPhoneSimulator
|
||||
{F4D99EF7-F197-428F-92DE-7482DBAD7476}.Ad-Hoc|iPhoneSimulator.Build.0 = Ad-Hoc|iPhoneSimulator
|
||||
{F4D99EF7-F197-428F-92DE-7482DBAD7476}.Ad-Hoc|x64.ActiveCfg = Ad-Hoc|iPhone
|
||||
{F4D99EF7-F197-428F-92DE-7482DBAD7476}.Ad-Hoc|x86.ActiveCfg = Ad-Hoc|iPhone
|
||||
{F4D99EF7-F197-428F-92DE-7482DBAD7476}.AppStore|Any CPU.ActiveCfg = AppStore|iPhone
|
||||
{F4D99EF7-F197-428F-92DE-7482DBAD7476}.AppStore|ARM.ActiveCfg = AppStore|iPhone
|
||||
{F4D99EF7-F197-428F-92DE-7482DBAD7476}.AppStore|iPhone.ActiveCfg = AppStore|iPhone
|
||||
{F4D99EF7-F197-428F-92DE-7482DBAD7476}.AppStore|iPhone.Build.0 = AppStore|iPhone
|
||||
{F4D99EF7-F197-428F-92DE-7482DBAD7476}.AppStore|iPhoneSimulator.ActiveCfg = AppStore|iPhoneSimulator
|
||||
{F4D99EF7-F197-428F-92DE-7482DBAD7476}.AppStore|iPhoneSimulator.Build.0 = AppStore|iPhoneSimulator
|
||||
{F4D99EF7-F197-428F-92DE-7482DBAD7476}.AppStore|x64.ActiveCfg = AppStore|iPhone
|
||||
{F4D99EF7-F197-428F-92DE-7482DBAD7476}.AppStore|x86.ActiveCfg = AppStore|iPhone
|
||||
{F4D99EF7-F197-428F-92DE-7482DBAD7476}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator
|
||||
{F4D99EF7-F197-428F-92DE-7482DBAD7476}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator
|
||||
{F4D99EF7-F197-428F-92DE-7482DBAD7476}.Debug|ARM.ActiveCfg = Debug|iPhone
|
||||
{F4D99EF7-F197-428F-92DE-7482DBAD7476}.Debug|iPhone.ActiveCfg = Debug|iPhone
|
||||
{F4D99EF7-F197-428F-92DE-7482DBAD7476}.Debug|iPhone.Build.0 = Debug|iPhone
|
||||
{F4D99EF7-F197-428F-92DE-7482DBAD7476}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
|
||||
{F4D99EF7-F197-428F-92DE-7482DBAD7476}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
|
||||
{F4D99EF7-F197-428F-92DE-7482DBAD7476}.Debug|x64.ActiveCfg = Debug|iPhone
|
||||
{F4D99EF7-F197-428F-92DE-7482DBAD7476}.Debug|x86.ActiveCfg = Debug|iPhone
|
||||
{F4D99EF7-F197-428F-92DE-7482DBAD7476}.Release|Any CPU.ActiveCfg = Release|iPhoneSimulator
|
||||
{F4D99EF7-F197-428F-92DE-7482DBAD7476}.Release|Any CPU.Build.0 = Release|iPhoneSimulator
|
||||
{F4D99EF7-F197-428F-92DE-7482DBAD7476}.Release|ARM.ActiveCfg = Release|iPhone
|
||||
{F4D99EF7-F197-428F-92DE-7482DBAD7476}.Release|iPhone.ActiveCfg = Release|iPhone
|
||||
{F4D99EF7-F197-428F-92DE-7482DBAD7476}.Release|iPhone.Build.0 = Release|iPhone
|
||||
{F4D99EF7-F197-428F-92DE-7482DBAD7476}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
|
||||
{F4D99EF7-F197-428F-92DE-7482DBAD7476}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
|
||||
{F4D99EF7-F197-428F-92DE-7482DBAD7476}.Release|x64.ActiveCfg = Release|iPhone
|
||||
{F4D99EF7-F197-428F-92DE-7482DBAD7476}.Release|x86.ActiveCfg = Release|iPhone
|
||||
{C6469FB2-9CF4-453E-9ADF-0ACBC386A113}.Ad-Hoc|Any CPU.ActiveCfg = Release|x86
|
||||
{C6469FB2-9CF4-453E-9ADF-0ACBC386A113}.Ad-Hoc|Any CPU.Build.0 = Release|x86
|
||||
{C6469FB2-9CF4-453E-9ADF-0ACBC386A113}.Ad-Hoc|Any CPU.Deploy.0 = Release|x86
|
||||
{C6469FB2-9CF4-453E-9ADF-0ACBC386A113}.Ad-Hoc|ARM.ActiveCfg = Release|ARM
|
||||
{C6469FB2-9CF4-453E-9ADF-0ACBC386A113}.Ad-Hoc|ARM.Build.0 = Release|ARM
|
||||
{C6469FB2-9CF4-453E-9ADF-0ACBC386A113}.Ad-Hoc|ARM.Deploy.0 = Release|ARM
|
||||
{C6469FB2-9CF4-453E-9ADF-0ACBC386A113}.Ad-Hoc|iPhone.ActiveCfg = Release|x86
|
||||
{C6469FB2-9CF4-453E-9ADF-0ACBC386A113}.Ad-Hoc|iPhone.Build.0 = Release|x86
|
||||
{C6469FB2-9CF4-453E-9ADF-0ACBC386A113}.Ad-Hoc|iPhone.Deploy.0 = Release|x86
|
||||
{C6469FB2-9CF4-453E-9ADF-0ACBC386A113}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|x86
|
||||
{C6469FB2-9CF4-453E-9ADF-0ACBC386A113}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|x86
|
||||
{C6469FB2-9CF4-453E-9ADF-0ACBC386A113}.Ad-Hoc|iPhoneSimulator.Deploy.0 = Release|x86
|
||||
{C6469FB2-9CF4-453E-9ADF-0ACBC386A113}.Ad-Hoc|x64.ActiveCfg = Release|x64
|
||||
{C6469FB2-9CF4-453E-9ADF-0ACBC386A113}.Ad-Hoc|x64.Build.0 = Release|x64
|
||||
{C6469FB2-9CF4-453E-9ADF-0ACBC386A113}.Ad-Hoc|x64.Deploy.0 = Release|x64
|
||||
{C6469FB2-9CF4-453E-9ADF-0ACBC386A113}.Ad-Hoc|x86.ActiveCfg = Release|x86
|
||||
{C6469FB2-9CF4-453E-9ADF-0ACBC386A113}.Ad-Hoc|x86.Build.0 = Release|x86
|
||||
{C6469FB2-9CF4-453E-9ADF-0ACBC386A113}.Ad-Hoc|x86.Deploy.0 = Release|x86
|
||||
{C6469FB2-9CF4-453E-9ADF-0ACBC386A113}.AppStore|Any CPU.ActiveCfg = Release|x86
|
||||
{C6469FB2-9CF4-453E-9ADF-0ACBC386A113}.AppStore|Any CPU.Build.0 = Release|x86
|
||||
{C6469FB2-9CF4-453E-9ADF-0ACBC386A113}.AppStore|Any CPU.Deploy.0 = Release|x86
|
||||
{C6469FB2-9CF4-453E-9ADF-0ACBC386A113}.AppStore|ARM.ActiveCfg = Release|ARM
|
||||
{C6469FB2-9CF4-453E-9ADF-0ACBC386A113}.AppStore|ARM.Build.0 = Release|ARM
|
||||
{C6469FB2-9CF4-453E-9ADF-0ACBC386A113}.AppStore|ARM.Deploy.0 = Release|ARM
|
||||
{C6469FB2-9CF4-453E-9ADF-0ACBC386A113}.AppStore|iPhone.ActiveCfg = Release|x86
|
||||
{C6469FB2-9CF4-453E-9ADF-0ACBC386A113}.AppStore|iPhone.Build.0 = Release|x86
|
||||
{C6469FB2-9CF4-453E-9ADF-0ACBC386A113}.AppStore|iPhone.Deploy.0 = Release|x86
|
||||
{C6469FB2-9CF4-453E-9ADF-0ACBC386A113}.AppStore|iPhoneSimulator.ActiveCfg = Release|x86
|
||||
{C6469FB2-9CF4-453E-9ADF-0ACBC386A113}.AppStore|iPhoneSimulator.Build.0 = Release|x86
|
||||
{C6469FB2-9CF4-453E-9ADF-0ACBC386A113}.AppStore|iPhoneSimulator.Deploy.0 = Release|x86
|
||||
{C6469FB2-9CF4-453E-9ADF-0ACBC386A113}.AppStore|x64.ActiveCfg = Release|x64
|
||||
{C6469FB2-9CF4-453E-9ADF-0ACBC386A113}.AppStore|x64.Build.0 = Release|x64
|
||||
{C6469FB2-9CF4-453E-9ADF-0ACBC386A113}.AppStore|x64.Deploy.0 = Release|x64
|
||||
{C6469FB2-9CF4-453E-9ADF-0ACBC386A113}.AppStore|x86.ActiveCfg = Release|x86
|
||||
{C6469FB2-9CF4-453E-9ADF-0ACBC386A113}.AppStore|x86.Build.0 = Release|x86
|
||||
{C6469FB2-9CF4-453E-9ADF-0ACBC386A113}.AppStore|x86.Deploy.0 = Release|x86
|
||||
{C6469FB2-9CF4-453E-9ADF-0ACBC386A113}.Debug|Any CPU.ActiveCfg = Debug|x86
|
||||
{C6469FB2-9CF4-453E-9ADF-0ACBC386A113}.Debug|Any CPU.Build.0 = Debug|x86
|
||||
{C6469FB2-9CF4-453E-9ADF-0ACBC386A113}.Debug|Any CPU.Deploy.0 = Debug|x86
|
||||
{C6469FB2-9CF4-453E-9ADF-0ACBC386A113}.Debug|ARM.ActiveCfg = Debug|ARM
|
||||
{C6469FB2-9CF4-453E-9ADF-0ACBC386A113}.Debug|ARM.Build.0 = Debug|ARM
|
||||
{C6469FB2-9CF4-453E-9ADF-0ACBC386A113}.Debug|ARM.Deploy.0 = Debug|ARM
|
||||
{C6469FB2-9CF4-453E-9ADF-0ACBC386A113}.Debug|iPhone.ActiveCfg = Debug|x86
|
||||
{C6469FB2-9CF4-453E-9ADF-0ACBC386A113}.Debug|iPhoneSimulator.ActiveCfg = Debug|x86
|
||||
{C6469FB2-9CF4-453E-9ADF-0ACBC386A113}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{C6469FB2-9CF4-453E-9ADF-0ACBC386A113}.Debug|x64.Build.0 = Debug|x64
|
||||
{C6469FB2-9CF4-453E-9ADF-0ACBC386A113}.Debug|x64.Deploy.0 = Debug|x64
|
||||
{C6469FB2-9CF4-453E-9ADF-0ACBC386A113}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{C6469FB2-9CF4-453E-9ADF-0ACBC386A113}.Debug|x86.Build.0 = Debug|x86
|
||||
{C6469FB2-9CF4-453E-9ADF-0ACBC386A113}.Debug|x86.Deploy.0 = Debug|x86
|
||||
{C6469FB2-9CF4-453E-9ADF-0ACBC386A113}.Release|Any CPU.ActiveCfg = Release|x86
|
||||
{C6469FB2-9CF4-453E-9ADF-0ACBC386A113}.Release|Any CPU.Build.0 = Release|x86
|
||||
{C6469FB2-9CF4-453E-9ADF-0ACBC386A113}.Release|Any CPU.Deploy.0 = Release|x86
|
||||
{C6469FB2-9CF4-453E-9ADF-0ACBC386A113}.Release|ARM.ActiveCfg = Release|ARM
|
||||
{C6469FB2-9CF4-453E-9ADF-0ACBC386A113}.Release|ARM.Build.0 = Release|ARM
|
||||
{C6469FB2-9CF4-453E-9ADF-0ACBC386A113}.Release|ARM.Deploy.0 = Release|ARM
|
||||
{C6469FB2-9CF4-453E-9ADF-0ACBC386A113}.Release|iPhone.ActiveCfg = Release|x86
|
||||
{C6469FB2-9CF4-453E-9ADF-0ACBC386A113}.Release|iPhoneSimulator.ActiveCfg = Release|x86
|
||||
{C6469FB2-9CF4-453E-9ADF-0ACBC386A113}.Release|x64.ActiveCfg = Release|x64
|
||||
{C6469FB2-9CF4-453E-9ADF-0ACBC386A113}.Release|x64.Build.0 = Release|x64
|
||||
{C6469FB2-9CF4-453E-9ADF-0ACBC386A113}.Release|x64.Deploy.0 = Release|x64
|
||||
{C6469FB2-9CF4-453E-9ADF-0ACBC386A113}.Release|x86.ActiveCfg = Release|x86
|
||||
{C6469FB2-9CF4-453E-9ADF-0ACBC386A113}.Release|x86.Build.0 = Release|x86
|
||||
{C6469FB2-9CF4-453E-9ADF-0ACBC386A113}.Release|x86.Deploy.0 = Release|x86
|
||||
{E1ED970F-0056-4353-B648-D5AC2B9633C2}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{E1ED970F-0056-4353-B648-D5AC2B9633C2}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU
|
||||
{E1ED970F-0056-4353-B648-D5AC2B9633C2}.Ad-Hoc|ARM.ActiveCfg = Debug|Any CPU
|
||||
{E1ED970F-0056-4353-B648-D5AC2B9633C2}.Ad-Hoc|ARM.Build.0 = Debug|Any CPU
|
||||
{E1ED970F-0056-4353-B648-D5AC2B9633C2}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU
|
||||
{E1ED970F-0056-4353-B648-D5AC2B9633C2}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU
|
||||
{E1ED970F-0056-4353-B648-D5AC2B9633C2}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU
|
||||
{E1ED970F-0056-4353-B648-D5AC2B9633C2}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU
|
||||
{E1ED970F-0056-4353-B648-D5AC2B9633C2}.Ad-Hoc|x64.ActiveCfg = Debug|Any CPU
|
||||
{E1ED970F-0056-4353-B648-D5AC2B9633C2}.Ad-Hoc|x64.Build.0 = Debug|Any CPU
|
||||
{E1ED970F-0056-4353-B648-D5AC2B9633C2}.Ad-Hoc|x86.ActiveCfg = Debug|Any CPU
|
||||
{E1ED970F-0056-4353-B648-D5AC2B9633C2}.Ad-Hoc|x86.Build.0 = Debug|Any CPU
|
||||
{E1ED970F-0056-4353-B648-D5AC2B9633C2}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{E1ED970F-0056-4353-B648-D5AC2B9633C2}.AppStore|Any CPU.Build.0 = Debug|Any CPU
|
||||
{E1ED970F-0056-4353-B648-D5AC2B9633C2}.AppStore|ARM.ActiveCfg = Debug|Any CPU
|
||||
{E1ED970F-0056-4353-B648-D5AC2B9633C2}.AppStore|ARM.Build.0 = Debug|Any CPU
|
||||
{E1ED970F-0056-4353-B648-D5AC2B9633C2}.AppStore|iPhone.ActiveCfg = Debug|Any CPU
|
||||
{E1ED970F-0056-4353-B648-D5AC2B9633C2}.AppStore|iPhone.Build.0 = Debug|Any CPU
|
||||
{E1ED970F-0056-4353-B648-D5AC2B9633C2}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU
|
||||
{E1ED970F-0056-4353-B648-D5AC2B9633C2}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU
|
||||
{E1ED970F-0056-4353-B648-D5AC2B9633C2}.AppStore|x64.ActiveCfg = Debug|Any CPU
|
||||
{E1ED970F-0056-4353-B648-D5AC2B9633C2}.AppStore|x64.Build.0 = Debug|Any CPU
|
||||
{E1ED970F-0056-4353-B648-D5AC2B9633C2}.AppStore|x86.ActiveCfg = Debug|Any CPU
|
||||
{E1ED970F-0056-4353-B648-D5AC2B9633C2}.AppStore|x86.Build.0 = Debug|Any CPU
|
||||
{E1ED970F-0056-4353-B648-D5AC2B9633C2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{E1ED970F-0056-4353-B648-D5AC2B9633C2}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{E1ED970F-0056-4353-B648-D5AC2B9633C2}.Debug|ARM.ActiveCfg = Debug|Any CPU
|
||||
{E1ED970F-0056-4353-B648-D5AC2B9633C2}.Debug|ARM.Build.0 = Debug|Any CPU
|
||||
{E1ED970F-0056-4353-B648-D5AC2B9633C2}.Debug|iPhone.ActiveCfg = Debug|Any CPU
|
||||
{E1ED970F-0056-4353-B648-D5AC2B9633C2}.Debug|iPhone.Build.0 = Debug|Any CPU
|
||||
{E1ED970F-0056-4353-B648-D5AC2B9633C2}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
|
||||
{E1ED970F-0056-4353-B648-D5AC2B9633C2}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
|
||||
{E1ED970F-0056-4353-B648-D5AC2B9633C2}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{E1ED970F-0056-4353-B648-D5AC2B9633C2}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{E1ED970F-0056-4353-B648-D5AC2B9633C2}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{E1ED970F-0056-4353-B648-D5AC2B9633C2}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{E1ED970F-0056-4353-B648-D5AC2B9633C2}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{E1ED970F-0056-4353-B648-D5AC2B9633C2}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{E1ED970F-0056-4353-B648-D5AC2B9633C2}.Release|ARM.ActiveCfg = Release|Any CPU
|
||||
{E1ED970F-0056-4353-B648-D5AC2B9633C2}.Release|ARM.Build.0 = Release|Any CPU
|
||||
{E1ED970F-0056-4353-B648-D5AC2B9633C2}.Release|iPhone.ActiveCfg = Release|Any CPU
|
||||
{E1ED970F-0056-4353-B648-D5AC2B9633C2}.Release|iPhone.Build.0 = Release|Any CPU
|
||||
{E1ED970F-0056-4353-B648-D5AC2B9633C2}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
|
||||
{E1ED970F-0056-4353-B648-D5AC2B9633C2}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
|
||||
{E1ED970F-0056-4353-B648-D5AC2B9633C2}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{E1ED970F-0056-4353-B648-D5AC2B9633C2}.Release|x64.Build.0 = Release|Any CPU
|
||||
{E1ED970F-0056-4353-B648-D5AC2B9633C2}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{E1ED970F-0056-4353-B648-D5AC2B9633C2}.Release|x86.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {336F6A20-5163-4815-B7AA-5841458E16E4}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<packageRestore>
|
||||
<add key="enabled" value="True"/>
|
||||
<add key="automatic" value="True"/>
|
||||
</packageRestore>
|
||||
<packageSources>
|
||||
<add key="Syncfusion Xamarin Source Package 17.1.0.38" value="https://api.nuget.org/v3/index.json"/></packageSources>
|
||||
<activePackageSource>
|
||||
</activePackageSource>
|
||||
<bindingRedirects>
|
||||
<add key="skip" value="False"/>
|
||||
</bindingRedirects>
|
||||
</configuration>
|
|
@ -0,0 +1,19 @@
|
|||
Any raw assets you want to be deployed with your application can be placed in
|
||||
this directory (and child directories) and given a Build Action of "AndroidAsset".
|
||||
|
||||
These files will be deployed with you package and will be accessible using Android's
|
||||
AssetManager, like this:
|
||||
|
||||
public class ReadAsset : Activity
|
||||
{
|
||||
protected override void OnCreate (Bundle bundle)
|
||||
{
|
||||
base.OnCreate (bundle);
|
||||
|
||||
InputStream input = Assets.Open ("my_asset.txt");
|
||||
}
|
||||
}
|
||||
|
||||
Additionally, some Android functions will automatically load asset files:
|
||||
|
||||
Typeface tf = Typeface.CreateFromAsset (Context.Assets, "fonts/samplefont.ttf");
|
|
@ -0,0 +1,38 @@
|
|||
#region Copyright Syncfusion Inc. 2001-2019.
|
||||
// Copyright Syncfusion Inc. 2001-2019. 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 Android.App;
|
||||
using Android.Content.PM;
|
||||
using Android.Runtime;
|
||||
using Android.Views;
|
||||
using Android.Widget;
|
||||
using Android.OS;
|
||||
using SampleBrowser.Core.Droid;
|
||||
|
||||
namespace SampleBrowser.PDF.Droid
|
||||
{
|
||||
[Activity(Label = "SampleBrowser PDF", Icon = "@drawable/AppIcon", Theme = "@style/MainTheme", MainLauncher = false, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
|
||||
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
|
||||
{
|
||||
protected override void OnCreate(Bundle bundle)
|
||||
{
|
||||
TabLayoutResource = Resource.Layout.Tabbar;
|
||||
ToolbarResource = Resource.Layout.Toolbar;
|
||||
|
||||
base.OnCreate(bundle);
|
||||
|
||||
global::Xamarin.Forms.Forms.Init(this, bundle);
|
||||
|
||||
// Pass the activity and Resources to core android project
|
||||
CoreSampleBrowser.Init(Resources, this);
|
||||
|
||||
LoadApplication(new App());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="auto">
|
||||
<uses-sdk android:minSdkVersion="16" />
|
||||
<application android:label="PDF Sample">
|
||||
<provider android:name="android.support.v4.content.FileProvider"
|
||||
android:authorities="${applicationId}.provider"
|
||||
android:exported="false"
|
||||
android:grantUriPermissions="true">
|
||||
<meta-data android:name="android.support.FILE_PROVIDER_PATHS"
|
||||
android:resource="@xml/provider_paths" />
|
||||
</provider>
|
||||
</application>
|
||||
</manifest>
|
|
@ -0,0 +1,43 @@
|
|||
#region Copyright Syncfusion Inc. 2001-2019.
|
||||
// Copyright Syncfusion Inc. 2001-2019. 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.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using Android.App;
|
||||
using Xamarin.Forms.Internals;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("SampleBrowser.PDF.Android")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Syncfusion Inc.")]
|
||||
[assembly: AssemblyProduct("SampleBrowser.PDF.Android")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2001-2019 Syncfusion Inc.")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
[assembly: ComVisible(false)]
|
||||
[assembly: Preserve]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
|
||||
// Add some common permissions, these can be removed if not needed
|
||||
[assembly: UsesPermission(Android.Manifest.Permission.Internet)]
|
||||
[assembly: UsesPermission(Android.Manifest.Permission.WriteExternalStorage)]
|
|
@ -0,0 +1,50 @@
|
|||
Images, layout descriptions, binary blobs and string dictionaries can be included
|
||||
in your application as resource files. Various Android APIs are designed to
|
||||
operate on the resource IDs instead of dealing with images, strings or binary blobs
|
||||
directly.
|
||||
|
||||
For example, a sample Android app that contains a user interface layout (main.xml),
|
||||
an internationalization string table (strings.xml) and some icons (drawable-XXX/icon.png)
|
||||
would keep its resources in the "Resources" directory of the application:
|
||||
|
||||
Resources/
|
||||
drawable-hdpi/
|
||||
icon.png
|
||||
|
||||
drawable-ldpi/
|
||||
icon.png
|
||||
|
||||
drawable-mdpi/
|
||||
icon.png
|
||||
|
||||
layout/
|
||||
main.xml
|
||||
|
||||
values/
|
||||
strings.xml
|
||||
|
||||
In order to get the build system to recognize Android resources, set the build action to
|
||||
"AndroidResource". The native Android APIs do not operate directly with filenames, but
|
||||
instead operate on resource IDs. When you compile an Android application that uses resources,
|
||||
the build system will package the resources for distribution and generate a class called
|
||||
"Resource" that contains the tokens for each one of the resources included. For example,
|
||||
for the above Resources layout, this is what the Resource class would expose:
|
||||
|
||||
public class Resource {
|
||||
public class drawable {
|
||||
public const int icon = 0x123;
|
||||
}
|
||||
|
||||
public class layout {
|
||||
public const int main = 0x456;
|
||||
}
|
||||
|
||||
public class strings {
|
||||
public const int first_string = 0xabc;
|
||||
public const int second_string = 0xbcd;
|
||||
}
|
||||
}
|
||||
|
||||
You would then use R.drawable.icon to reference the drawable/icon.png file, or Resource.layout.main
|
||||
to reference the layout/main.xml file, or Resource.strings.first_string to reference the first
|
||||
string in the dictionary file values/strings.xml.
|