首页 \ 问答 \ 用于从Excel报告创建PDF文件的体系结构(Architecture for creating PDF files from Excel reports)

用于从Excel报告创建PDF文件的体系结构(Architecture for creating PDF files from Excel reports)

我有1个例程,结构如下:

  1. C# console C打开xl工作簿A.
  2. C然后运行A的宏M,它使用VBA将目标工作表保存为PDF
  3. C然后使用PDFsharp加密PDF文件。
  4. C然后通过电子邮件发送此文件

目前此过程适用于一个报告,因此如果体系结构不是教科书则没有问题。

我想在未来可能会有许多不同工作簿中的许多目标工作表都会出现在许多不同的收件人身上。 如果是这种情况,则需要执行步骤2,因为我不希望将此VBA代码复制到每个目标工作簿中! 我可以想象的唯一选择,因为我的经验有限,如下:

  1. 从Excel中取出当前的VBA代码,并使用对Excel.Interops的引用将其移动到Excel.Interops

假设目标工作表是完成的文章,即在转到PDF之前不需要进一步操作,上面是将此步骤移出VBA并进入控制台的正确方法,还是应该使用不同的库创建PDF?


I have 1 routine that is structured like this:

  1. C# console C opens xl workbook A
  2. C then runs A's macro M which saves the target worksheet as a PDF using VBA
  3. C then uses PDFsharp to encrypt the PDF file.
  4. C then emails this file.

Currently this procedure is for one report so no problem if the architecture isn't textbook.

I imagine in the future there may be many target worksheets in many different workbooks all going to lots of different recipients. If this is the case then Step 2 will need to go as I will not want to have to copy this VBA code into every target workbook! The only alternative I can imagine as my experience is limited is the following:

  1. Take the current VBA code out of Excel and move it into C using a reference to Excel.Interops

Assuming that the target worksheets are the finished article i.e. no further manipulation is required before going to PDF is the above the correct approach for moving this step out of VBA and into the console, or should I create the PDF using a different library?


原文:https://stackoverflow.com/questions/13857379
更新时间:2023-09-20 22:09

最满意答案

从左到右的关联性意味着表达式隐式括起来,如下所示:

(((cout << "foo") << "bar") << "baz")

换句话说,最左边的操作首先出现。

相比之下,在大多数语言中,作业是正确联合的:

a = b = c + 5;

c + 5分配给“a”和“b”,因为赋值运算符从右到左工作。


Left to right associativity means that the expression is implicitly parenthesized like this:

(((cout << "foo") << "bar") << "baz")

In other words, the leftmost operation comes first.

By contrast, assignment is right-associative in most languages:

a = b = c + 5;

assigns c + 5 to both "a" and "b" because the assignment operator works from right-to-left.

相关问答

更多
  • 1 in [] in 'a'被评估为(1 in []) and ([] in 'a') 。 由于第一个条件( 1 in [] )为False ,因此将整个条件评估为False ; ([] in 'a')从未被实际评估,因此不会引起错误。 以下是语句定义: In [121]: def func(): .....: return 1 in [] in 'a' .....: In [122]: dis.dis(func) 2 0 LOAD_CONST ...
  • 从左到右的关联性意味着表达式隐式括起来,如下所示: (((cout << "foo") << "bar") << "baz") 换句话说,最左边的操作首先出现。 相比之下,在大多数语言中,作业是正确联合的: a = b = c + 5; 将c + 5分配给“a”和“b”,因为赋值运算符从右到左工作。 Left to right associativity means that the expression is implicitly parenthesized like this: (((cout << ...
  • 从...开始 T->L S T|L 并考虑a+b+c ,它可以从T产生如下: T -> L S T -> L S (L S T) -> L S (L S (L)) -> L S (L S (c)) -> L S (b + (c)) -> L + (b + (c)) -> a + (b + (c)) (括号仅作为解析树的简写。) 最右边的推导是独一无二的; T不能匹配(a + b) + c因为a + b不是L 因此, +和-是“右关联的”。 相比之下,我们有 E->E W T|T ...
  • 我相信你在这里缺少的是操作员优先权 。 指针成员访问运算符( -> )的优先级高于强制转换。 详细说明,( 借用的措辞 ) 运算符优先级确定在具有多个具有不同优先级的运算符的表达式中首先执行哪个运算符。 当两个具有相同优先级的运算符出现在表达式中时,使用(或发挥作用)关联性。 I believe the point you're missing here is the Operator Precedence. The pointer member access operator (->) has highe ...
  • 当前(和)是ID中允许的字符,因此您的示例字符串将分为以下标记: (B32 | B5) & B31 另一个问题是你不区分&和|的优先级 在你的表达规则中。 这意味着像X|Y&B这样的表达式将等同于您的语言中的(X|Y)&B ,其中大多数语言将优先考虑并使其等同于X|(Y&B) 。 要更正这些项目,您可能需要执行以下操作。 从ID规则中删除'('和')' 。 如果需要命名标记,可以选择添加以下内容。 LPAREN : '('; RPAREN : ')'; 更正expr规则以单独处理&和| 。 expr: ' ...
  • 来自野牛文档: 运算符优先级由声明的行顺序决定; 声明的行号越高(页面或屏幕越低),优先级越高。 因此,在您的情况下,OR在屏幕上较低并且具有较高的优先级。 将订单更改为 %left OR %left AND (我还没有测试过) From bison docs: Operator precedence is determined by the line ordering of the declarations; the higher the line number of the declaration ( ...
  • JavaScript从左到右评估表达式。 我们可以通过使用其他变量来显示正在发生的事情: var foo = {}; var bar = foo; // keep a reference to the object originally stored in foo foo.x = foo = {n: 2}; 由于关联性,最后一个语句被解析为: foo.x = (foo = {n: 2}); 但是由于评估顺序, foo.x首先运行(确定存储值的位置),然后是foo ,然后运行{n: 2} 。 所以我们将 ...
  • 我不敢相信有这么多错误(删除)的答案......也许我应该回答这个问题。 首先, 优先!=关联!=评估顺序 。 现在我们已经解决了这个问题:在某些情况下,关联性很重要。 对于a + b + c ,当a , b和c是浮点数而不是整数时,这很重要,因为舍入误差将根据术语的分组方式而不同地累积。 对于&&和||的特殊情况 , 只要它们没有被重载 (这只能在C ++中,而不是在C中),那么它并不重要,但是为了一致性,语言仍然定义了一个 - 并且使得代码的“树”表示(基于在语法上)是独一无二的。 从现在开始,C ++ ...
  • 通常它的语法是“自然的”: 考虑x - y + z 。 你希望它是从左到右,以便得到(x - y) + z而不是x - (y + z) 。 考虑a = b = c 。 你希望这是从右到左,以便得到a = (b = c) ,而不是(a = b) = c 。 我无法想象这个选择似乎是“任意”做出的例子。 免责声明:我不知道Ruby,所以我上面的示例基于C语法。 但我相信Ruby中也适用相同的原则。 Typically it's so the syntax is "natural": Consider x - y ...
  • 您的优先 顺序与执行顺序混淆。 例: a[b] += b += c * d + e * f * g 优先规则规定*来自+之前+=之前。 关联性规则(它是优先规则的一部分)表明*是左关联的, +=是右关联的。 优先级/关联性规则基本上定义了隐式括号的应用,将上述表达式转换为: a[b] += ( b += ( (c * d) + ((e * f) * g) ) ) 但是,此表达式仍然是从左到右评估的 。 这意味着表达式a[b]中b的索引值将使用b执行b += ...之前的b += ...值。 有关更复杂的 ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。