qwerrghj 2014-05-13 03:53 采纳率: 0%
浏览 5664

出错 使用泛型 类型“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:\temp\sample.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 = "line1\rline2\rline3";
        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中新建文档等。大家帮忙看看怎么修改

  • 写回答

1条回答 默认 最新

  • a491442025 2015-01-20 03:37
    关注
    评论

报告相同问题?

悬赏问题

  • ¥15 arduino控制ps2手柄一直报错
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥85 maple软件,solve求反函数,出现rootof怎么办?
  • ¥15 求chat4.0解答一道线性规划题,用lingo编程运行,第一问要求写出数学模型和lingo语言编程模型,第二问第三问解答就行,我的ddl要到了谁来求了
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥65 汇编语言除法溢出问题
  • ¥15 Visual Studio问题
  • ¥20 求一个html代码,有偿
  • ¥100 关于使用MATLAB中copularnd函数的问题