public async override Task <bool> InvokeAsync(string paramList)
        {
            var section = new Section();

            section.Pane.ElementList.Add(new Rectangle {
                BorderColor = Color.Black, Left = "1cm", Top = "1cm", Bottom = "1cm", Right = "1cm"
            });
            section.Pane.ElementList.Add(new Line {
                Top = "0", Left = "0", Bottom = "0", Right = "0"
            });
            var template = new Template(section);

            var documentProperties = new DocumentProperties
            {
            };

            var sampleData = new DocumentData();

            var pageSizeInfo = new PageSizeInfo("A4");

            await PdfCommand.RenderPdfAsync(template, documentProperties, sampleData, pageSizeInfo, false, true);

            //var renderer = new Renderer(template, sampleData, documentProperties, pageSizeInfo, false);
            //var printerSettings = new PrinterSettings { };
            //renderer.Print(printerSettings, true, true);

            return(true);
        }
        /// <summary>
        /// This is used implicitly by -[LiveQuery update] to decide whether the query result has changed
        /// enough to notify the client.
        /// </summary>
        /// <remarks>
        /// This is used implicitly by -[LiveQuery update] to decide whether the query result has changed
        /// enough to notify the client. So it's important that it not give false positives, else the app
        /// won't get notified of changes.
        /// </remarks>
        public override bool Equals(object obj)
        {
            if (obj == this)
            {
                return(true);
            }
            if (!(obj is QueryRow))
            {
                return(false);
            }

            var other = (QueryRow)obj;
            var documentPropertiesBothNull = (DocumentProperties == null && other.DocumentProperties == null);
            var documentPropertiesEqual    = documentPropertiesBothNull || DocumentProperties.Equals(other.DocumentProperties);

            if (Database == other.Database && Key.Equals(other.Key) && SourceDocumentId.Equals(other.SourceDocumentId) && documentPropertiesEqual)
            {
                // If values were emitted, compare them. Otherwise we have nothing to go on so check
                // if _anything_ about the doc has changed (i.e. the sequences are different.)
                if (Value != null || other.Value != null)
                {
                    return(Value.Equals(other.Value));
                }
                else
                {
                    return(SequenceNumber == other.SequenceNumber);
                }
            }
            return(false);
        }
        internal void Initialize(string workbookName, Workbook workbook)
        {
            if (workbook == null)
            {
                return;
            }

            this.documentProperties = workbook.DocumentProperties;

            this.lblInfo.Value = string.Format("{0} / <font color=\"Gray\">{1}</font>", ResourceStrings.ResourceManager.GetString("Text_Info"), workbookName);

            try
            {
                this.isInitializing   = true;
                this.txtTitle.Text    = this.documentProperties.Title;
                this.txtStatus.Text   = this.documentProperties.Status;
                this.txtSubject.Text  = this.documentProperties.Subject;
                this.txtCategory.Text = this.documentProperties.Category;
                this.txtCompany.Text  = this.documentProperties.Company;
                this.txtComments.Text = this.documentProperties.Comments;
                this.txtTags.Text     = this.documentProperties.Keywords;
                this.txtManager.Text  = this.documentProperties.Manager;
                this.txtAuthor.Text   = this.documentProperties.Author;
            }
            finally
            {
                this.isInitializing = false;
            }
        }
        public void TestReadWrite()
        {
            int size = _documentProperties.GetSize();

            byte[] buf = new byte[size];

            _documentProperties.Serialize(buf, 0);

            DocumentProperties newDocProperties =
                new DocumentProperties(buf, 0);

            FieldInfo[] fields = typeof(DocumentProperties).BaseType.GetFields(BindingFlags.Instance | BindingFlags.NonPublic);

            for (int x = 0; x < fields.Length; x++)
            {
                if (!fields[x].FieldType.IsArray)
                {
                    Assert.AreEqual(fields[x].GetValue(_documentProperties),
                                    fields[x].GetValue(newDocProperties));
                }
                else
                {
                    byte[] buf1 = (byte[])fields[x].GetValue(_documentProperties);
                    byte[] buf2 = (byte[])fields[x].GetValue(newDocProperties);
                    Arrays.Equals(buf1, buf2);
                }
            }
        }
Exemple #5
0
        public string ReadDocumentProperty(string propertyCode)
        {
            DocumentProperties properties = Application.ActiveDocument.BuiltInDocumentProperties as DocumentProperties;
            DocumentProperty   prop       = properties["code_conv"];

            return(prop.Value);
        }
        private static void RenderPdf(Template template, DocumentProperties documentProperties = null, DocumentData documentData = null, PageSizeInfo pageSizeInfo = null, bool debug = true, bool portrait = true)
        {
            var renderer = new Renderer(template, documentData, documentProperties, pageSizeInfo, debug);
            var bytes    = renderer.GetPdfBinary(true, portrait);

            Task.Factory.StartNew(() => ExecuteFile(bytes));
        }
Exemple #7
0
        //
        private int releaseToDoc(String strName)
        {
            if (m_doc == null)
            {
                return(-1);
            }

            DocumentProperties customProps = m_doc.CustomDocumentProperties;
            DocumentProperty   prop        = null;

            try
            {
                prop = (DocumentProperty)customProps[strName];
                if (prop != null)
                {
                    prop.Delete();
                }
            }
            catch (System.Exception ex)
            {
                // customProps.Add("Name" + (i + 1), false, MsoDocProperties.msoPropertyTypeString, "NameValue" + (i + 1));
                return(-2);
            }
            finally
            {
            }

            return(0);
        }
    public SpaceDocument createDocumemt()
    {
        DocumentProperties properties = new DocumentProperties();

        properties ["CatalogNumber"] = "av-9876";
        properties["Category"]       = "Aviation";
        properties["Name"]           = "Jet Propelled Pogo Stick";
        properties["Price"]          = 19.99;
        properties["Tags"]           = new String[4] {
            "New", "Cool", "Pogo", "Jet"
        };

        DocumentProperties p2 = new DocumentProperties();

        p2["Manufacturer"]     = "Acme";
        p2["RequiresAssembly"] = true;
        p2["NumberOfParts"]    = 42;
        properties["Features"] = p2;

        SpaceDocument document = new SpaceDocument("Product", properties);

        proxy.Write(document);

        return(document);
    }
Exemple #9
0
        /// <summary>
        /// Function which Marks a individual word as Abbreviation or Acronym
        /// </summary>
        public void Individual()
        {
            DocumentProperties xmlparts = (DocumentProperties)currentDoc.CustomDocumentProperties;

            //If call is from Abbreviation button
            if (checkAbbrAcr)
            {
                object missing  = System.Type.Missing;
                object val      = System.Reflection.Missing.Value;
                String nameAbbr = "Abbreviations" + GenerateId().ToString();
                //Adding bookmark for the selected Text
                currentDoc.Application.Selection.Bookmarks.Add(nameAbbr, ref val);

                object value = currentDoc.Application.Selection.Text.Trim() + "$#$" + tBx_MarkFullForm.Text.TrimEnd();
                //Adding a custom property to the current document
                xmlparts.Add(nameAbbr, false, type, value, System.Reflection.Missing.Value);
                this.Close();
            }
            else
            {
                object missing = System.Type.Missing;
                object val     = System.Reflection.Missing.Value;
                String nameAcr = "Acronyms" + pronounceAbbrAcr + GenerateId().ToString();
                //Adding bookmark for the selected Text
                currentDoc.Application.Selection.Bookmarks.Add(nameAcr, ref val);

                object value = currentDoc.Application.Selection.Text.Trim() + "$#$" + tBx_MarkFullForm.Text.TrimEnd();
                //Adding a custom property to the current document
                xmlparts.Add(nameAcr, false, type, value, System.Reflection.Missing.Value);
                this.Close();
            }
        }
Exemple #10
0
        public int getFromDoc(String strCategory, int nSlotSn, ref String strValue)
        {
            DocumentProperties customProps = m_doc.CustomDocumentProperties;
            DocumentProperty   prop        = null;

            try
            {
                prop = (DocumentProperty)customProps[strCategory + nSlotSn];
                if (prop != null && prop.Type == MsoDocProperties.msoPropertyTypeString)
                {
                    strValue = (String)prop.Value;
                }
                else
                {
                    return(-1);
                }

                // customProps.Add(strCategory + nSlotSn, false, MsoDocProperties.msoPropertyTypeString, strValue);
            }
            catch (System.Exception ex)
            {
                // customProps.Add(strCategory + nSlotSn, false, MsoDocProperties.msoPropertyTypeString, strValue);
                return(-2);
            }
            finally
            {
            }

            return(0);
        }
Exemple #11
0
        // to doc
        // alloc
        // release

        private int allocInDoc(String strCategory, int nMaxIndex, int nNum, ref ArrayList retArr)
        {
            if (m_doc == null)
            {
                return(-1);
            }

            DocumentProperties customProps = m_doc.CustomDocumentProperties;
            DocumentProperty   prop        = null;

            for (int i = nMaxIndex; i < (nMaxIndex + nNum); i++)
            {
                try
                {
                    prop = (DocumentProperty)customProps[strCategory + i];
                    if (prop != null)
                    {
                        prop.Delete();
                    }
                    customProps.Add(strCategory + i, false, MsoDocProperties.msoPropertyTypeString, strCategory + i);
                }
                catch (System.Exception ex)
                {
                    customProps.Add(strCategory + i, false, MsoDocProperties.msoPropertyTypeString, strCategory + i);
                    // return -2;
                }
                finally
                {
                }

                retArr.Add(i);
            }

            return(0);
        }
Exemple #12
0
        public int saveIntoDoc(String strCategory, int nSlotSn, String strValue)
        {
            DocumentProperties customProps = m_doc.CustomDocumentProperties;
            DocumentProperty   prop        = null;

            try
            {
                prop = (DocumentProperty)customProps[strCategory + nSlotSn];
                if (prop != null)
                {
                    prop.Delete();
                }
                customProps.Add(strCategory + nSlotSn, false, MsoDocProperties.msoPropertyTypeString, strValue);
            }
            catch (System.Exception ex)
            {
                // customProps.Add(strCategory + nSlotSn, false, MsoDocProperties.msoPropertyTypeString, strValue);
                return(-1);
            }
            finally
            {
            }

            return(0);
        }
Exemple #13
0
        public int getFromDoc(String strCategory, ArrayList arrSlots, ref String strValue)
        {
            DocumentProperties customProps = m_doc.CustomDocumentProperties;
            DocumentProperty   prop        = null;

            int nCnt = 0;

            foreach (int nSlotSn in arrSlots)
            {
                try
                {
                    prop = (DocumentProperty)customProps[strCategory + nSlotSn];
                    if (prop != null && prop.Type == MsoDocProperties.msoPropertyTypeString)
                    {
                        strValue += (String)prop.Value;
                        nCnt++;
                    }

                    // customProps.Add(strCategory + nSlotSn, false, MsoDocProperties.msoPropertyTypeString, strValue);
                }
                catch (System.Exception ex)
                {
                    // customProps.Add(strCategory + nSlotSn, false, MsoDocProperties.msoPropertyTypeString, strValue);
                    continue;
                }
                finally
                {
                }
            }

            return(nCnt);
        }
Exemple #14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PostSlidesSetDocumentPropertiesRequest"/> class.
 /// </summary>
 /// <param name="name">Document name.</param>
 /// <param name="properties">New properties.</param>
 /// <param name="folder">Document folder.</param>
 /// <param name="storage">Document storage.</param>
 public PostSlidesSetDocumentPropertiesRequest(string name, DocumentProperties properties = null, string folder = null, string storage = null)
 {
     this.Name       = name;
     this.Properties = properties;
     this.Folder     = folder;
     this.Storage    = storage;
 }
Exemple #15
0
        public void Upload()
        {
            Save();

            var fullpath           = AcadApp.DocumentManager.MdiActiveDocument.Name;
            var documentProperties = DocumentProperties.FromActiveDocument();

            var dmsDocument = new DmsDocument
            {
                DocumentId    = documentProperties.DocumentId,
                FileContent   = File.ReadAllBytes(fullpath),
                FileExtension = "DWG"
            };

            var result = CadDms.UploadDocument(dmsDocument);

            if (!result.Success)
            {
                MessageBox.Show(
                    string.Format("It was not possible to upload the file!{0}{0}{1}", Environment.NewLine, result.Message),
                    "Save and upload",
                    MessageBoxButton.OK,
                    MessageBoxImage.Error);
            }
        }
Exemple #16
0
 /// <summary>Constructs a new PdfADocument for writing purposes, i.e. from scratch.</summary>
 /// <remarks>
 /// Constructs a new PdfADocument for writing purposes, i.e. from scratch. A
 /// PDF/A file has a conformance level, and must have an explicit output
 /// intent.
 /// </remarks>
 /// <param name="writer">
 /// the
 /// <see cref="iText.Kernel.Pdf.PdfWriter"/>
 /// object to write to
 /// </param>
 /// <param name="conformanceLevel">the generation and strictness level of the PDF/A that must be followed.</param>
 /// <param name="outputIntent">
 /// a
 /// <see cref="iText.Kernel.Pdf.PdfOutputIntent"/>
 /// </param>
 /// <param name="properties">
 /// a
 /// <see cref="iText.Kernel.Pdf.DocumentProperties"/>
 /// </param>
 public PdfADocument(PdfWriter writer, PdfAConformanceLevel conformanceLevel, PdfOutputIntent outputIntent,
                     DocumentProperties properties)
     : base(writer, properties)
 {
     SetChecker(conformanceLevel);
     AddOutputIntent(outputIntent);
 }
        /// <summary>
        /// Sets workbook document properties.
        /// </summary>
        /// <param name="workbook">The workbook.</param>
        /// <returns>
        /// The specified workbook with document properties set.
        /// </returns>
        /// <param name="documentProperties">The document properties to set.</param>
        /// <exception cref="ArgumentNullException"><paramref name="workbook"/> is null.</exception>
        public static Workbook SetDocumentProperties(
            this Workbook workbook,
            DocumentProperties documentProperties)
        {
            if (workbook == null)
            {
                throw new ArgumentNullException(nameof(workbook));
            }

            var result = workbook;

            if (documentProperties != null)
            {
                var propertyKindToValueMap = documentProperties.BuiltInDocumentPropertyKindToValueMap;
                if (propertyKindToValueMap != null)
                {
                    foreach (var propertyKind in propertyKindToValueMap.Keys)
                    {
                        var propertyValue = propertyKindToValueMap[propertyKind];

                        if (propertyValue != null)
                        {
                            result.BuiltInDocumentProperties[propertyKind.ToBuiltInDocumentPropertyCollectionKey()].Value = propertyValue;
                        }
                    }
                }
            }

            return(result);
        }
 /// <summary>
 /// </summary>
 /// <param name="e">An <see cref="T:System.EventArgs" /> that contains the event data.</param>
 protected override void OnVisibleChanged(EventArgs e)
 {
     base.OnVisibleChanged(e);
     if (this.Visible == false)
     {
         this.documentProperties = null;
     }
 }
        public void SetUp()
        {
            _hWPFDocFixture = new HWPFDocFixture(this);

            _hWPFDocFixture.SetUp();

            _documentProperties = new DocumentProperties(_hWPFDocFixture._tableStream, _hWPFDocFixture._fib.GetFcDop());
        }
Exemple #20
0
        private static DocumentProperties CreateDocumentProperties()
        {
            var documentProperties = new DocumentProperties {
                Title = "Table example"
            };

            return(documentProperties);
        }
Exemple #21
0
        private static void testDOP()
        {
            byte[] dopBytes = new byte[(int)doc.FIB.lcbDop];
            doc.TableStream.Read(dopBytes, dopBytes.Length, (int)doc.FIB.fcDop);
            DocumentProperties dop = new DocumentProperties(doc.FIB, doc.TableStream);

            Console.WriteLine("Initial Footnote number: " + dop.nFtn);
        }
        private void UpdateCustomProperties(string documentId)
        {
            var documentProperties = DocumentProperties.FromActiveDocument();

            documentProperties.DocumentId = documentId;

            documentProperties.SetOnActiveDocument();
        }
Exemple #23
0
        public void DOPTest()
        {
            var dopBytes = new byte[(int)this.doc.FIB.lcbDop];

            this.doc.TableStream.Read(dopBytes, dopBytes.Length, (int)this.doc.FIB.fcDop);
            var dop = new DocumentProperties(this.doc.FIB, this.doc.TableStream);

            Console.WriteLine("Initial Footnote number: " + dop.nFtn);
        }
Exemple #24
0
        private void ProcessDocument(SharePointDocument document, string filePath)
        {
            TraceFactory.Logger.Debug("Found file: " + document.FileName);

            try
            {
                string         fileName   = Path.GetFileName(filePath);
                ScanFilePrefix filePrefix = ScanFilePrefix.Parse(fileName);

                // Create the log for this file
                DigitalSendJobOutputLogger log = new DigitalSendJobOutputLogger(fileName, filePrefix.ToString(), filePrefix.SessionId);
                log.FileSentDateTime = document.Created.LocalDateTime;
                log.FileLocation     = $@"{_library.SiteUrl.Host}\{_library.Name}";

                // Validate and analyze the file
                OutputProcessor  processor = new OutputProcessor(filePath);
                ValidationResult result    = null;
                Retry.WhileThrowing(
                    () => result = processor.Validate(Configuration),
                    10,
                    TimeSpan.FromSeconds(2),
                    new List <Type>()
                {
                    typeof(IOException)
                });

                // If the validation failed, there is a small chance that the HPS file arrived
                // a little later than the PDF and didn't get downloaded at the same time.
                // Check the server to see if that's the case - if so, run the validation again
                if (!result.Succeeded && result.Message.Contains("metadata", StringComparison.OrdinalIgnoreCase))
                {
                    if (FindMetadataFile(document))
                    {
                        result = processor.Validate(Configuration);
                    }
                }

                DocumentProperties properties = processor.GetProperties();
                log.FileSizeBytes = properties.FileSize;
                log.PageCount     = properties.Pages;
                log.SetErrorMessage(result);

                // Clean up the file
                processor.ApplyRetention(Configuration, result.Succeeded);

                // Send the output log
                new DataLogger(GetLogServiceHost(filePrefix.SessionId)).Submit(log);
            }
            catch (IOException ex)
            {
                LogProcessFileError(filePath, ex);
            }
            catch (FormatException ex)
            {
                LogProcessFileError(filePath, ex);
            }
        }
Exemple #25
0
 public DocumentProperties(DocumentProperties props)
 {
     this.Id          = props.Id;
     this.LinkId      = props.LinkId;
     this.Label       = props.Label;
     this.Author      = props.Author;
     this.Description = props.Description;
     this.Date        = props.Date;
     this.Photo       = props.Photo;
 }
		public DocumentController(MainController mainController, Document document)
		{
			this.mainController = mainController;
			this.document = document;

			documentProperties = (DocumentProperties) document.CustomDocumentProperties;

			var documentStyleTitle = GetDocumentStyleTitle();
			style = mainController.FindStyleByTitle(documentStyleTitle) ?? mainController.DefaultStyle;
		}
Exemple #27
0
        private async void propBox_Click(object sender, RoutedEventArgs e)
        {
            strFolderProp = string.Empty;
            strFileProp   = string.Empty;

            filePropArea.IsReadOnly  = false;
            foldrPropArea.IsReadOnly = false;

            if (newFolder != null)
            {
                BasicProperties basicProperties = await newFolder.GetBasicPropertiesAsync();

                DocumentProperties docProp = await newFolder.Properties.GetDocumentPropertiesAsync();

                strFolderProp += Helper.GetResourceString("ID_FLDR_NAME") + " - " + newFolder.Name + "\r\n" + "\r\n" +
                                 Helper.GetResourceString("ID_DATE_CRT") + ": " + newFolder.DateCreated + "\r\n" +
                                 Helper.GetResourceString("ID_TYPE") + ": " + newFolder.DisplayType + "\r\n" +
                                 Helper.GetResourceString("ID_DATE_MDF") + ": " + basicProperties.DateModified + "\r\n" +
                                 Helper.GetResourceString("ID_SIZE") + ": " + basicProperties.Size;

                foldrPropArea.Document.SetText(TextSetOptions.None, strFolderProp);
            }
            else
            {
                ContentDialog dialog = Helper.GetDialog();
                dialog.Content = Helper.GetResourceString("ID_FLDR_PROP_MSG");
                await dialog.ShowAsync();
            }

            if (newFile != null)
            {
                BasicProperties basicProperties = await newFile.GetBasicPropertiesAsync();

                DocumentProperties docProp = await newFile.Properties.GetDocumentPropertiesAsync();

                strFileProp += Helper.GetResourceString("ID_FILE_NAME") + " - " + newFile.Name + "\r\n" + "\r\n" +
                               Helper.GetResourceString("ID_DATE_CRT") + ": " + newFile.DateCreated + "\r\n" +
                               Helper.GetResourceString("ID_TYPE") + ": " + newFile.DisplayType + "\r\n" +
                               Helper.GetResourceString("ID_FILE_TYPE") + ": " + newFile.FileType + "\r\n" +
                               Helper.GetResourceString("ID_CONTENT_TYPE") + ": " + newFile.ContentType + "\r\n" +
                               Helper.GetResourceString("ID_DATE_MDF") + ": " + basicProperties.DateModified + "\r\n" +
                               Helper.GetResourceString("ID_SIZE") + ": " + basicProperties.Size;

                filePropArea.Document.SetText(TextSetOptions.None, strFileProp);
            }
            else
            {
                ContentDialog dialog = Helper.GetDialog();
                dialog.Content = Helper.GetResourceString("ID_FILE_PROP_MSG");
                await dialog.ShowAsync();
            }

            filePropArea.IsReadOnly  = true;
            foldrPropArea.IsReadOnly = true;
        }
Exemple #28
0
    private void OnMatchOrCreateRequest(RequestLauncher.RequestAnswerDocument item, bool success)
    {
        if (success && String.IsNullOrEmpty(item.Error))
        {
            CameraFrame frame        = item.CameraFrameFromBase64();
            Texture2D   croppedPhoto = new Texture2D(frame.Resolution.width, frame.Resolution.height);
            croppedPhoto.SetPixels32(frame.Data);
            croppedPhoto.Apply();

            DocumentCollection.Instance.AddDocument(croppedPhoto, item.Id);
            DocumentProperties received = DocumentCollection.Instance.Documents[DocumentCollection.Instance.Documents.Count - 1].GetComponent <DocumentManager>().Properties;
            received.Author      = item.Author;
            received.Description = item.Desc;
            received.Label       = item.Label;

            Debug.Log("ici");
            if (item.Link != null) // we are in a link, we need to see if the link localy exists
            {
                Debug.Log("ici");
                List <GameObject> docs = DocumentCollection.Instance.Documents;

                foreach (string id in item.Link)
                {
                    foreach (GameObject doc in docs)
                    {
                        DocumentProperties prop = doc.GetComponent <DocumentManager>().Properties;
                        if (prop != null && id == prop.Id)
                        {
                            if (prop.LinkId != -1)
                            {
                                Debug.Log("la");
                                LinkManager.Instance.Links[prop.LinkId].Add(doc);
                                doc.GetComponent <DocumentManager>().SetColor(LinkManager.Instance.Links[prop.LinkId].LinkColor);
                            }
                            else if (docs[docs.Count - 1] != doc)
                            {
                                Debug.Log("bloup");
                                LinkManager.Instance.OnLinkStarted(doc);
                                LinkManager.Instance.OnLinkEnded(docs[docs.Count - 1], false);
                            }

                            goto EndOfLoop;
                        }
                    }
                }
                EndOfLoop :;
            }
        }
        else
        {
            Debug.Log(item.Error);
            Debug.Log("nop");
            this.photoMode = true;
        }
    }
        private void GetFileStatistics(TestDocument doc, string filePath)
        {
            FileAnalyzer       analyzer = FileAnalyzerFactory.Create(filePath);
            DocumentProperties stats    = analyzer.GetProperties();

            doc.Pages       = stats.Pages;
            doc.Author      = stats.Author;
            doc.Application = stats.Application;
            doc.FileSize    = stats.FileSize;
            doc.Orientation = (stats.Orientation ?? Framework.Documents.Orientation.Portrait).ToString();
        }
		public static string GetCustomStringProperty(DocumentProperties documentProperties, string name, string defaultValue = null)
		{
			try
			{
				return (string) documentProperties[name].Value;
			}
			catch
			{
				return defaultValue;
			}
		}
Exemple #31
0
        public DocumentController(MainController mainController, Document document)
        {
            this.mainController = mainController;
            this.document       = document;

            documentProperties = (DocumentProperties)document.CustomDocumentProperties;

            var documentStyleTitle = GetDocumentStyleTitle();

            style = mainController.FindStyleByTitle(documentStyleTitle) ?? mainController.DefaultStyle;
        }
Exemple #32
0
        private void ButtonBase_OnClick(object sender, RoutedEventArgs e)
        {
            var section = new Section();

            section.Pane.ElementList.Add(new Text {
                Value = "My label"
            });
            var template = new Template(section);

            var documentProperties = new DocumentProperties();

            var sampleData = new DocumentData();

            DocumentData documentData = null;

            var debug = false;

            var dialog = new System.Windows.Controls.PrintDialog
            {
                UserPageRangeEnabled = false,
                SelectedPagesEnabled = false,
            };

            if (dialog.ShowDialog() == true)
            {
                var printerSettings = new PrinterSettings
                {
                    Copies      = (short)(dialog.PrintTicket.CopyCount ?? 1),
                    PrinterName = dialog.PrintQueue.FullName,
                };

                PageSizeInfo pageSizeInfo  = null;
                var          pageMediaSize = dialog.PrintTicket.PageMediaSize;
                if (pageMediaSize.PageMediaSizeName != null)
                {
                    try
                    {
                        pageSizeInfo = new PageSizeInfo(pageMediaSize.PageMediaSizeName.Value.ToString());
                    }
                    catch (ArgumentException)
                    {
                        pageSizeInfo = new PageSizeInfo((pageMediaSize.Width / 96) + "inch", (pageMediaSize.Height / 96) + "inch");
                    }
                }

                var renderer = new Renderer(template, documentData, documentProperties, pageSizeInfo, debug);

                //Send document to the printer
                renderer.Print(printerSettings);

                //Create a pdf for the same document
                var data = renderer.GetPdfBinary();
            }
        }
		public static bool DeleteCustomProperty(DocumentProperties documentProperties, string propertyID)
		{
			try
			{
				documentProperties[propertyID].Delete();

				return true;
			}
			catch
			{
				return false;
			}
		}
		public static bool AddCustomProperty(DocumentProperties documentProperties, string name, CustomPropertyType type, object value)
		{
			try
			{
				documentProperties.Add(name, false, type, value);

				return true;
			}
			catch
			{
				return false;
			}
		}
        public static void Run()
        {
            // For complete examples and data files, please go to https:// Github.com/aspose-slides/Aspose.Slides-for-.NET

            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_PresentationProperties();

            DocumentProperties template = new DocumentProperties();
            template.Author = "Template Author";
            template.Title = "Template Title";
            template.Category = "Template Category";
            template.Keywords = "Keyword1, Keyword2, Keyword3";
            template.Company = "Our Company";
            template.Comments = "Created from template";
            template.ContentType = "Template Content";
            template.Subject = "Template Subject";

            UpdateByTemplate(dataDir + "doc1.pptx", template);
            UpdateByTemplate(dataDir + "doc2.odp", template);
            UpdateByTemplate(dataDir + "doc3.ppt", template);
        }
    public SpaceDocument createDocumemt()
    {
        DocumentProperties properties = new DocumentProperties ();

        properties ["CatalogNumber"] = "av-9876";
        properties["Category"]= "Aviation";
        properties["Name"] = "Jet Propelled Pogo Stick";
        properties["Price"]= 19.99;
        properties["Tags"]= new String[4] {"New", "Cool", "Pogo", "Jet"};

        DocumentProperties p2 = new DocumentProperties();
        p2["Manufacturer"]="Acme";
        p2["RequiresAssembly"]=true;
        p2["NumberOfParts"]= 42;
        properties["Features"]=p2;

        SpaceDocument document = new SpaceDocument("Product", properties);
        proxy.Write(document);

        return document;
    }
Exemple #37
0
 public Workbook()
 {
     _Properties = new DocumentProperties();
     _ExcelWorkbook = new ExcelWorkbookDetails();
     _SheetStyles = new SheetStyles();
     _Worksheets = new ExcelWorksheets();
     _Names = new NamedRanges();
 }
 private void clearProperties(DocumentProperties properties)
 {
     foreach (DocumentProperty property in properties)
     {
         if (property.Name.Equals(WordDocumentProperties.AHPDetailsProprtyName))
         {
             properties[WordDocumentProperties.AHPDetailsProprtyName].Delete();
         }
     }
 }
		public static bool SetCustomProperty(DocumentProperties documentProperties, string name, CustomPropertyType type, object value)
		{
			DeleteCustomProperty(documentProperties, name);

			return AddCustomProperty(documentProperties, name, type, value);
		}