如何命名使用VB.net创建的Excel工作簿 下面是我的代码
public class CustomerBuilder {
private Customer customer = new Customer();
public CustomerBuilder setName(String name){
customer.setName(name);
return this;
}
public CustomerBuilder setSurname(String surname){
customer.setSurname(surname);
return this;
}
public CustomerBuilder setAge(int age){
customer.setAge(age);
return this;
}
public CustomerBuilder setEmail(String email){
customer.setEmail(email);
return this;
}
public Customer build() {
return customer;
}
}
public class OrderBuilder {
private Order order = new Order();
public OrderBuilder setCustomer(Customer customer){
order.setCustomer(customer);
return this;
}
public OrderBuilder setProduct(Product product){
order.setProduct(product);
return this;
}
public OrderBuilder setQuantity(int quantity){
order.setQuantity(quantity);
return this;
}
public OrderBuilder setOrderDate(LocalDate orderDate){
order.setOrderDate(orderDate);
return this;
}
public Order build(){
return order;
}
}
public class ProductBuilder {
private Product product = new Product();
public ProductBuilder setCategory(Category category){
product.setCategory(category);
return this;
}
public ProductBuilder setName(String name){
product.setName(name);
return this;
}
public ProductBuilder setPrice(BigDecimal bigDecimal){
product.setPrice(bigDecimal);
return this;
}
public Product build() {
return product;
}
}
我希望下面的行产生设置工作簿的名称,但它总是给我一个错误。
appXL = CreateObject("Excel.Application")
wbXL = appXL.Workbooks.Add()
我也尝试了下面的代码,但是没有用。
wbXL.Name = "WorkbookName"
任何帮助将不胜感激
答案 0 :(得分:0)
感谢@Storax提供指针。我能够想到这个
if (this.RegistrationForm.valid) {
if (this.RegistrationForm.get('password1') == this.RegistrationForm.get('password2')) {
this.MyService.Register(this.RegistrationForm.value).subscribe((data) => {}, error => this.errorMessage = error)
} else {
this.errorMessage = "cdscs";
}
}
constructor(private fb: FormBuilder, private MyService: RoadSignService) {
this.RegistrationForm = this.fb.group({
Id: 0,
name: ['', [Validators.required]],
email: ['', [Validators.required]],
gender: ['', [Validators.required]],
department: ['', [Validators.required]],
address: ['', [Validators.required]],
password1: ['', [Validators.required]],
password2: ['', [Validators.required]]
})
}
我将编写代码以查看目录并在代码重新运行时随时删除文件,因此它不会要求覆盖,因为它已经存在。
非常感谢你们