当前位置: 首页>>代码示例>>C#>>正文


C# Doc类代码示例

本文整理汇总了C#中Doc的典型用法代码示例。如果您正苦于以下问题:C# Doc类的具体用法?C# Doc怎么用?C# Doc使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Doc类属于命名空间,在下文中一共展示了Doc类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {

            if (Request.QueryString["xID"] == null)
            {
                SessionObject.RedirectMessage = "No entity ID provided in URL.";
                Response.Redirect("~/PortalSelection.aspx", true);
            }
            else
            {
                _addendumID = GetDecryptedEntityId(X_ID);
            }

            Doc doc = new Doc();

			doc = Assessment.RenderAssessmentAddendumToPdf(_addendumID, ConfigHelper.GetImagesUrl());

            byte[] theData = doc.GetData();
            Response.ContentType = "application/pdf";
            Response.AddHeader("content-disposition", "inline; filename=MyPDF.PDF");
            Response.AddHeader("content-length", theData.Length.ToString());
            Response.BinaryWrite(theData);

            ThinkgateEventSource.Log.ApplicationEvent(MethodBase.GetCurrentMethod().DeclaringType.ToString() + "->" + MethodBase.GetCurrentMethod().Name, "Finished rendering PDF for addendum " + _addendumID, string.Empty);
        }
开发者ID:ezimaxtechnologies,项目名称:ASP.Net,代码行数:25,代码来源:RenderAddendumAsPDF.aspx.cs

示例2: Main

    static void Main(string[] args)
    {
        try {
          Configuration.Default.Username = "YOUR_API_KEY_HERE"; // this key works for test documents
          DocApi docraptor = new DocApi();

          Doc doc = new Doc(
        Test: true,                                                    // test documents are free but watermarked
        DocumentContent: "<html><body>Hello World</body></html>",      // supply content directly
        // DocumentUrl: "http://docraptor.com/examples/invoice.html",  // or use a url
        Name: "docraptor-csharp.pdf",                                  // help you find a document later
        DocumentType: Doc.DocumentTypeEnum.Pdf                         // pdf or xls or xlsx
        // Javascript: true,                                           // enable JavaScript processing
        // PrinceOptions: new PrinceOptions(
        //   Media: "screen",                                          // use screen styles instead of print styles
        //   Baseurl: "http://hello.com"                               // pretend URL when using document_content
        // )
          );

          byte[] create_response = docraptor.CreateDoc(doc);
          File.WriteAllBytes("/tmp/docraptor-csharp.pdf", create_response);
          Console.WriteLine("Wrote PDF to /tmp/docraptor-csharp.pdf");
        } catch (DocRaptor.Client.ApiException error) {
          Console.WriteLine(error);
        }
    }
开发者ID:DocRaptor,项目名称:docraptor-csharp,代码行数:26,代码来源:sync.cs

示例3: Main

    static void Main(string[] args)
    {
        Configuration.Default.Username = "YOUR_API_KEY_HERE";
        // Configuration.Default.Debug = true; // Not supported in Csharp
        DocApi docraptor = new DocApi();

        Doc doc = new Doc(
          Name: new String('s', 201), // limit is 200 characters
          Test: true,
          DocumentContent: "<html><body>Hello from C#</body></html>",
          DocumentType: Doc.DocumentTypeEnum.Pdf
        );

        AsyncDoc response = docraptor.CreateAsyncDoc(doc);

        AsyncDocStatus status_response;
        for(int i=0; i<30; i++) {
          status_response = docraptor.GetAsyncDocStatus(response.StatusId);
          if (status_response.Status == "failed") {
        Environment.Exit(0);
          }
          Thread.Sleep(1000);
        }
        Console.WriteLine("Did not receive failed validation within 30 seconds.");
        Environment.Exit(1);
    }
开发者ID:DocRaptor,项目名称:docraptor-csharp,代码行数:26,代码来源:invalid_async.cs

示例4: InnerSerialization

 protected override string InnerSerialization(object obj)
 {
     var doc = new Doc { Document = obj };
     var myXmlNode = JsonConvert.DeserializeXmlNode(JsonConvert.SerializeObject(doc));
     var result = myXmlNode.InnerXml;
     return result;
 }
开发者ID:okulovsky,项目名称:Saturn,代码行数:7,代码来源:XmlSerializer.cs

示例5: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            int docID =Convert.ToInt32( Request.QueryString["docID"]);
            Doc dc = new Doc();
            dc.Docload(docID);
            txtTitle.Text = dc.docTitle;
            txtAbstract.Text = dc.docAbstract;
            txtKeyword.Text = dc.docKeywords;
            txtLetters.Text = dc.docLetters.ToString();
            txtAuthorInfo.Text = dc.docAuthor;

        }
        if (DropDownList1.SelectedValue != "11")
        {
            CheckBoxList1.Visible = false;
            RequiredFieldValidator1.Enabled = true;
        }
        else
        {
            CheckBoxList1.Visible = true;
            RequiredFieldValidator1.Enabled = false;
        }
    }
开发者ID:huaminglee,项目名称:OnlinePublish,代码行数:25,代码来源:assess.aspx.cs

示例6: InsertingAndReadingDocumentWithReadOnlyFlagShouldWork

        public void InsertingAndReadingDocumentWithReadOnlyFlagShouldWork()
        {
            using (var store = NewDocumentStore())
            {
                string docId;
                using (var session = store.OpenSession())
                {
                    var doc = new Doc { Name = "Name1" };
                    session.Store(doc);
                    session.Advanced.GetMetadataFor(doc)[Constants.RavenReadOnly] = true;

                    session.SaveChanges();

                    docId = doc.Id;
                }

                using (var session = store.OpenSession())
                {
                    var doc = session.Load<Doc>(docId);

                    Assert.NotNull(doc);
                    Assert.Equal("Name1", doc.Name);
                }
            }
        }
开发者ID:WimVergouwe,项目名称:ravendb,代码行数:25,代码来源:RDBQA_1.cs

示例7: RavenJToken_DeepEquals_Array_Test

        public void RavenJToken_DeepEquals_Array_Test()
        {
            var original = new {Tokens = new[] {"Token-1", "Token-2", "Token-3"}};
            var modified = new {Tokens = new[] {"Token-1", "Token-3"}};

            // In modified object we deleted one item "Token-2"

            var difference = new List<DocumentsChanges>();
            if (!RavenJToken.DeepEquals(RavenJObject.FromObject(modified), RavenJObject.FromObject(original), difference))
            {
                // OK
                // 1 difference - "Token-2" value removed
            }

            // Expecting one difference - "Token-2" ArrayValueRemoved
            Assert.True(difference.Count == 1 && difference.SingleOrDefault(x => x.Change == DocumentsChanges.ChangeType.ArrayValueRemoved &&
                                                                                 x.FieldOldValue == "Token-2") != null);

            var originalDoc = new Doc {Names = new List<PersonName> {new PersonName {Name = "Tom1"}, new PersonName {Name = "Tom2"}, new PersonName {Name = "Tom3"}}};
            var modifiedDoc = new Doc {Names = new List<PersonName> {new PersonName {Name = "Tom1"}, new PersonName {Name = "Tom3"}}};

            // In modified object we deleted one item "Tom2"

            difference = new List<DocumentsChanges>();
            if (!RavenJToken.DeepEquals(RavenJObject.FromObject(modifiedDoc), RavenJObject.FromObject(originalDoc), difference))
            {
                // SOMETHING WRONG?
                // 3 differences - "Tom1", "Tom2", "Tom3" objects removed
            }

            // Expecting one difference - "Tom2" ArrayValueRemoved
            Assert.True(difference.Count == 1 && difference.SingleOrDefault(x => x.Change == DocumentsChanges.ChangeType.ArrayValueRemoved &&
                                                                                 x.FieldOldValue == "{\r\n  \"Name\": \"Tom2\"\r\n}") != null);
        }
开发者ID:j2jensen,项目名称:ravendb,代码行数:34,代码来源:RavenDB_3042.cs

示例8: GridStream

        internal GridStream(
      Collection collection, 
      string name, 
      Doc fileInfo, 
      FileAccess access)
        {
            Contract.Requires(fileInfo != null);
              _collection = collection;
              _chunks = _collection.ChunkCollection();
              _fileInfo = new FileInfo(fileInfo, _collection);

              long rem;
              _totalChunks = (int)Math.DivRem(_fileInfo.Length, _fileInfo.ChunkSize, out rem);
              _totalChunks = rem > 0 ? _totalChunks + 1 : _totalChunks;
              _chunks.CreateIndex(new Index { { "files_id", Mongo.Dir.Asc }, { "n", Mongo.Dir.Asc } }, true);
              LoadChunk(0);
              _position = 0L;
              switch (access)
              {
            case FileAccess.Read:
              _canRead = true;
              break;
            case FileAccess.ReadWrite:
              _canRead = true;
              _canWrite = true;
              break;
            case FileAccess.Write:
              _canWrite = true;
              break;
              }
              _canSeek = true;
        }
开发者ID:dannycoates,项目名称:mongo-clr4-driver,代码行数:32,代码来源:GridStream.cs

示例9: Main

    static void Main(string[] args)
    {
        Configuration.Default.Username = "YOUR_API_KEY_HERE";
        // Configuration.Default.Debug = true; // Not supported in Csharp
        DocApi docraptor = new DocApi();

        Doc doc = new Doc(
          Name: "csharp-async.pdf",
          Test: true,
          DocumentContent: "<html><body>Hello from C#</body></html>",
          DocumentType: Doc.DocumentTypeEnum.Pdf
        );

        AsyncDoc response = docraptor.CreateAsyncDoc(doc);

        AsyncDocStatus status_response;
        while(true) {
          status_response = docraptor.GetAsyncDocStatus(response.StatusId);
          if (status_response.Status == "completed") {
        break;
          }
          Thread.Sleep(1000);
        }

        docraptor.GetAsyncDoc(status_response.DownloadId);
    }
开发者ID:DocRaptor,项目名称:docraptor-csharp,代码行数:26,代码来源:async.cs

示例10: Main

        static void Main(string[] args)
        {
            System.Console.WriteLine("Enter the name of the output pdf file:");

            var fileName = System.Console.ReadLine();
            fileName = fileName.Replace(".pdf", "");
            fileName = fileName.Replace(".PDF", "");

            Doc theDoc = new Doc();
            theDoc.Rect.Inset(72, 144);
            theDoc.HtmlOptions.AddLinks = true;

            int theID;
            theID = theDoc.AddImageUrl("http://www.yahoo.com/");

            while (true)
            {
                theDoc.FrameRect();
                if (!theDoc.Chainable(theID))
                    break;
                theDoc.Page = theDoc.AddPage();
                theID = theDoc.AddImageToChain(theID);
            }

            for (int i = 1; i <= theDoc.PageCount; i++)
            {
                theDoc.PageNumber = i;
                theDoc.Flatten();
            }

            theDoc.Save(System.IO.Path.Combine(System.IO.Directory.GetCurrentDirectory(), fileName + ".pdf"));
            theDoc.Clear();
        }
开发者ID:mradamlacey,项目名称:AbcPdfConsoleTest,代码行数:33,代码来源:Program.cs

示例11: Bt_upload_Click

    protected void Bt_upload_Click(object sender, EventArgs e)
    {
        if (FileUpload1.HasFile)
        {
            string oldname = FileUpload1.FileName;
            string type = FileUpload1.FileName.Substring(FileUpload1.FileName.LastIndexOf(".") + 1);            //获取上传文件的后缀
            string filename = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Day.ToString() + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString() + DateTime.Now.Millisecond.ToString() + "." + type;

            if (type == "doc")
            {

                if (FileUpload1.FileName != "")
                {
                    //更改上传文件名

                    String path = Server.MapPath("~/upfiles/" + filename);
                    FileUpload1.PostedFile.SaveAs(path);
                }

                string author = Request.Cookies["userID"].Value.ToString();
                string state = "0";

                Hashtable docHt = new Hashtable();
                docHt.Add("docTime", SQLString.GetQuotedString(DateTime.Now.ToString()));
                docHt.Add("docTitle", SQLString.GetQuotedString(Session["docTitle"].ToString()));
                docHt.Add("docTitleEn", SQLString.GetQuotedString(Session["docTitleEn"].ToString()));
                docHt.Add("docAbstract", SQLString.GetQuotedString(Session["docAbstract"].ToString()));
                docHt.Add("docAbstractEn", SQLString.GetQuotedString(Session["docAbstractEn"].ToString()));
                docHt.Add("docKeywords", SQLString.GetQuotedString(Session["docKeywords"].ToString()));
                docHt.Add("docKeywordsEn", SQLString.GetQuotedString(Session["docKeywordsEn"].ToString()));
                docHt.Add("docLetters", SQLString.GetQuotedString(Session["docLetters"].ToString()));
                docHt.Add("docAuthor", SQLString.GetQuotedString(Session["docAuthor"].ToString()));
                docHt.Add("docColumnID", SQLString.GetQuotedString(Session["docColumnID"].ToString()));
                docHt.Add("authorID", SQLString.GetQuotedString(author));
                docHt.Add("docState", SQLString.GetQuotedString(state));

                Doc dc = new Doc();
                dc.Add(docHt);
                int docID = dc.GetID(author);

                Hashtable ht = new Hashtable();
                ht.Add("attachFilename", SQLString.GetQuotedString(oldname));
                ht.Add("attachName", SQLString.GetQuotedString(filename));
                ht.Add("docID", SQLString.GetQuotedString(Convert.ToString(docID)));
                Attach attach = new Attach();
                attach.Add(ht);

                Response.Write("<script language='javascript'>alert('投稿成功,谢谢您对本刊的支持!')</script>");
                Response.Write("<script>window.location='contribution1.aspx';</script>");

            }
            else
            {
                Response.Write("<script language='javascript'>alert('对不起,目前只接受.doc格式文档,请重新上传!')</script>");
            }

        }
    }
开发者ID:huaminglee,项目名称:OnlinePublish,代码行数:58,代码来源:contribution3.aspx.cs

示例12: GridViewBind

 public void GridViewBind()
 {
     DataSet ds = new DataSet();
     string author = Request.Cookies["userID"].Value.ToString();
     Doc dc = new Doc();
     ds = dc.LoadRepairdoc(author);
     GridView1.DataSource = ds.Tables[0];
     GridView1.DataBind();
 }
开发者ID:huaminglee,项目名称:OnlinePublish,代码行数:9,代码来源:modifylist.aspx.cs

示例13: GridviewBind

 private void GridviewBind()
 {
     string title = txtdocTitle.Text;
     string author = txtauthorID.Text;
     string state = "25";
     Doc dc = new Doc();
     DataSet ds = dc.adminload(title, author, state);
     GridView1.DataSource = ds;
     GridView1.DataBind();
 }
开发者ID:huaminglee,项目名称:OnlinePublish,代码行数:10,代码来源:reassesslist.aspx.cs

示例14: ToDoc

 public static Doc ToDoc(this IEnumerable<string> fields)
 {
     var d = new Doc();
       if (fields == null) return d;
       foreach (var item in fields)
       {
     d[item] = 1;
       }
       return d;
 }
开发者ID:dannycoates,项目名称:mongo-clr4-driver,代码行数:10,代码来源:Bson.cs

示例15: printbutton_Click

    protected void printbutton_Click(object sender, EventArgs e)
    {
        string contents = string.Empty;

        MemoryStream ms = new MemoryStream();
        //using (StringWriter sw = new StringWriter()) {
        //    Server.Execute("Documents/report.aspx", sw);
        //    contents = sw.ToString();
        //    sw.Close();
        //}

        try {

            Doc doc = new Doc();
            //int font = doc.EmbedFont(Server.MapPath("Documents/") + "OpenSans-Regular-webfont.ttf", LanguageType.Unicode);
            //font = doc.EmbedFont(Server.MapPath("Documents/") + "OpenSans-Light-webfont.ttf", LanguageType.Unicode);
            doc.HtmlOptions.BrowserWidth = 960;
            doc.HtmlOptions.FontEmbed = true;
            doc.HtmlOptions.FontSubstitute = false;
            doc.HtmlOptions.FontProtection = false;
            int id = 0;
            Random rnd = new Random();
            //id = doc.AddImageUrl("http://" + Request.Url.Host + "/documents/bygg.aspx?rnd=" + rnd.Next(50000));
            id = doc.AddImageUrl("http://localhost:50030/Documents/jour.aspx?rnd=" + rnd.Next(50000));

            while (true) {
                //doc.FrameRect();
                if (!doc.Chainable(id)) {
                    break;
                }
                doc.Page = doc.AddPage();
                id = doc.AddImageToChain(id);
            }

            for (int i = 0; i < doc.PageCount; i++) {
                doc.PageNumber = i;
                doc.Flatten();
            }

            //doc.AddImageHtml(contents);
            //doc.Save(Server.MapPath("htmlimport.pdf"));
            doc.Save(ms);
            //doc.SaveOptions.
            doc.Clear();

                Response.ContentType = "application/pdf";
                Response.AddHeader("Content-Disposition", string.Format("attachment;filename=File-{0}.pdf", 1));
                Response.BinaryWrite(ms.ToArray());
                Response.End();

            //}
        } catch (Exception ex) {
            Response.Write(ex.Message);
        }
    }
开发者ID:peterbjons,项目名称:Eaztimate,代码行数:55,代码来源:bygg.aspx.cs


注:本文中的Doc类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。