.net-出错 使用泛型 类型“System.Collections.Generic.IEnumerable<T>”要“1”个类型实参

问题描述

出错 使用泛型 类型“System.Collections.Generic.IEnumerable<T>”要“1”个类型实参

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Net;
using InDesign;
using System.Diagnostics;

namespace WindowsFormsApplication3
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

    private void button1_Click(object sender, EventArgs e)
    {
        // Create application instance
        Type type = Type.GetTypeFromProgID("InDesign.Application");
        InDesign.Application application = (InDesign.Application)Activator.CreateInstance(type);

        // Set unit type
        application.ViewPreferences.HorizontalMeasurementUnits = idMeasurementUnits.idMillimeters;
        application.ViewPreferences.VerticalMeasurementUnits = idMeasurementUnits.idMillimeters;

        // Create new document
        application.Documents.Add(true, application.DocumentPresets.FirstItem());

        // Get active document and change some settings
        Document document = application.ActiveDocument;
        document.DocumentPreferences.FacingPages = false;
        document.DocumentPreferences.PageWidth = 210;
        document.DocumentPreferences.PageHeight = 297;

        // Get first page (already created) and set margins
        Page page = (Page)document.Pages[1];
        page.MarginPreferences.Top = 10;
        page.MarginPreferences.Bottom = 10;
        page.MarginPreferences.Left = 20;
        page.MarginPreferences.Right = 10;

        // Create rectangle and fit an image into it
        InDesign.Rectangle rectangle = page.Rectangles.Add(document.Layers.FirstItem(), idLocationOptions.idUnknown, page);
        rectangle.GeometricBounds = new[] { 20, 30, 120, 130 };
        rectangle.Place(@"c:tempsample.png", false);
        rectangle.Fit(idFitOptions.idContentToFrame);

        // Create second page and set margins
        page = document.Pages.Add(idLocationOptions.idUnknown, document);
        page.MarginPreferences.Top = 10;
        page.MarginPreferences.Bottom = 10;
        page.MarginPreferences.Left = 20;
        page.MarginPreferences.Right = 10;

        // Create a text frame and add some text
        TextFrame textFrame = page.TextFrames.Add(document.Layers.FirstItem(), idLocationOptions.idUnknown, page);
        textFrame.GeometricBounds = new[] { 20, 30, 120, 130 };
        textFrame.Contents = "line1rline2rline3";
        IEnumerator paragraphs = textFrame.Paragraphs.GetEnumerator();
        for (int j = 0; j < textFrame.Paragraphs.Count; j++)
        {
            paragraphs.MoveNext();
            Paragraph paragraph = ((Paragraph)paragraphs.Current);
            paragraph.Justification = idJustification.idCenterAlign;
            paragraph.PointSize = 15 - j;
            paragraph.FontStyle = "Regular";
            paragraph.AppliedFont = "Verdana";
        }
    }
}

}

这个是用c#在indesign中新建文档等。大家帮忙看看怎么修改

解决方案

http://zhangcui0311.blog.163.com/blog/static/43270001201123004646656/ 試試看這個

时间: 2025-01-19 06:57:39

.net-出错 使用泛型 类型“System.Collections.Generic.IEnumerable&amp;lt;T&amp;gt;”要“1”个类型实参的相关文章

无法将类型“System.Collections.Generic.IEnumerable&lt;EmailSystem.Model.TemplateInfo&gt;”隐式转换为“System.Collections.Generic.List&lt;EmailSystem.Model.TemplateInf

List<Model.Template> templateList = templateBLL.RecommendTemplateByOrder(modelEbay);        List<Model.TemplateInfo> recommandlist = templateList.Select(m => new Model.TemplateInfo                {                    AccountId = m.AccountID

“System.Collections.Generic.IEnumerable&lt;TestDAL.HistoryData&gt;”不包含“ToList”的定义

错误 2  "System.Collections.Generic.IEnumerable<TestDAL.HistoryData>"不包含"ToList"的定义,并且找不到可接受类型为"System.Collections.Generic.IEnumerable<TestDAL.HistoryData>"的第一个参数的扩展方法"ToList"(是否缺少 using 指令或程序集引用?) J:\太阳能近

传入字典的模型项的类型为“System.Collections.Generic.List`1[Community.Model.User]”,但此字典需要类型“C

问题描述 解决方案 解决方案二:泛型冲突,传入的数据不是泛型允许的

NotSupportedException-无法将类型“System.DateTime”强制转换为类型“System.Object”

几张图就可以说明一切 2015-03-29 21:54:09,206 [77] ERROR log - System.NotSupportedException: 无法将类型"System.DateTime"强制转换为类型"System.Object".LINQ to Entities 仅支持强制转换 EDM 基元或枚举类型. 在 System.Data.Entity.Core.Objects.ELinq.ExpressionConverter.ValidateAn

asp-无法将类型为“System.Int32”的对象强制转换为类型“System.Array”

问题描述 无法将类型为"System.Int32"的对象强制转换为类型"System.Array" 修改Edit.cshtml上部分字段,点击保存跳转到Index.cshtml. 但现在点击保存,就跳出以下错误. **这是Model ** using System; using System.Collections.Generic; using System.ComponentModel; using System.ComponentModel.DataAnnota

javascriptserializer-JavaScriptSerializer“ 没有为类型“System.String”定义无参数的构造函数”

问题描述 JavaScriptSerializer" 没有为类型"System.String"定义无参数的构造函数" JavaScriptSerializer c# 反序列化的时候报错" 没有为类型"System.String"定义无参数的构造函数 using System; using System.Collections.Generic; using System.Linq; using System.Text; using Sys

.NET 4.0新增命名空间:System.Collections.Concurrent

集合类的需求总是源源不断,因此,不管是1.0到2.0的泛型,还是3.0到4.0 的并行(本文的并行指Concurrent,非 Parallel),.NET每个版本总会伴随着一些 集合类的增长.由于并行计算现在已经越来越流行,这里我将对.NET 4.0中新增 的命名空间System.Collections.Concurrent和它下面的类做一些简单的介绍. 为什么需要Concurrent? 相信不少朋友都有多线程编程的经历吧,不过在.NET 4.0以前,多线程编程 下很容易出问题,先看个简单的例子

无法将类型为“System.Int32”的对象强制转换为类型“System.Array”

问题描述 修改Edit.cshtml上部分字段,点击保存跳转到Index.cshtml.但现在点击保存,就跳出以下错误.**这是Model**usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.ComponentModel.DataAnnotations;usingSystem.ComponentModel.DataAnnotations.Schema;usingSystem.Lin

无法将类型“System.Data.DataSet”隐式转换为“WebApplication1.DataSet2” 在线等,请各位高手帮忙

问题描述 namespaceWebApplication1{publicpartialclasshhhhhh:System.Web.UI.Page{///<summary>///sqlhelp的摘要说明///</summary>publicstaticclasssqlhelp{privatestaticstring_connstr="datasource=xzdb;uid=zc;pwd=zc;Unicode=True";publicstaticstringcon